Skip to content

Conversation

@tourze
Copy link
Contributor

@tourze tourze commented Jun 25, 2025

将 MIME 类型映射从动态文件加载改为静态数组定义,带来以下好处:

  • 消除运行时文件 I/O 操作,提升启动性能
  • 减少文件系统依赖,提高代码可移植性
  • 简化代码维护,MIME 类型映射直接可见
  • 避免文件读取失败的潜在风险
  • 减少不必要的函数导入

删除了 mime.types 文件和 initMimeTypeMap() 方法,将所有 MIME 类型 映射直接定义在 $mimeTypeMap 静态数组中。

🤖 Generated with Claude Code

将 MIME 类型映射从动态文件加载改为静态数组定义,带来以下好处:
- 消除运行时文件 I/O 操作,提升启动性能
- 减少文件系统依赖,提高代码可移植性
- 简化代码维护,MIME 类型映射直接可见
- 避免文件读取失败的潜在风险
- 减少不必要的函数导入

删除了 mime.types 文件和 initMimeTypeMap() 方法,将所有 MIME 类型
映射直接定义在 $mimeTypeMap 静态数组中。

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@joanhey
Copy link
Contributor

joanhey commented Jun 26, 2025

I think that is better to be in a separate file.

But we can change the mime.types file copied from nginx, to a PHP file that return the array.
Also the array need to be separated by type with a blank line, to read and modify easily.

PD: actually we need to add image/avif

@walkor walkor merged commit 7b7250e into walkor:master Jun 28, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants