简体   繁体   English

使用apache mod_expires来缓存php,php文件的mime类型是什么?

[英]Use apache mod_expires to cache php, what is a mime type for php files?

I want to cache php for few seconds in mod_expires, I can't find examples, nobody want to cache it (I know, I know). 我想在mod_expires中缓存PHP几秒钟,我找不到示例,没有人想要缓存它(我知道,我知道)。

What should I put into ExpiresByType to cache php? 我应该在ExpiresByType中放入什么来缓存php?

Debian uses text/x-php . Debian使用text/x-php https://packages.debian.org/sid/mime-support https://packages.debian.org/sid/mime-support

The IANA suggests text/x-php or application/x-php . IANA建议使用text/x-phpapplication/x-php https://www.ietf.org/rfc/rfc4329.txt https://www.ietf.org/rfc/rfc4329.txt

Please note that text/php or application/php probably won't work. 请注意, text/phpapplication/php可能无法工作。

What should I put into ExpiresByType to cache php? 我应该在ExpiresByType中放入什么来缓存php?

Whatever Content-Type your PHP scripts are generating. 无论您的PHP脚本生成什么Content-Type。 text/html if they're generating HTML pages, for instance. 例如,如果它们正在生成HTML页面,则为text/html

A better option is usually to generate Expires headers in PHP code. 更好的选择通常是用PHP代码生成Expires标头。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM