問題描述
使用 apache mod_expires 緩存 php,php 文件的 mime 類型是什麼? (Use apache mod_expires to cache php, what is a mime type for php files?)
我想在mod_expires中緩存php幾秒鐘,我找不到例子,沒有人想緩存它(我知道,我知道)。
我應該在ExpiresByType中放入什麼來緩存php ?
參考解法
方法 1:
Debian uses text/x‑php
. https://packages.debian.org/sid/mime‑support
The IANA suggests text/x‑php
or application/x‑php
. https://www.ietf.org/rfc/rfc4329.txt
Please note that text/php
or application/php
probably won't work.
方法 2:
What should I put into ExpiresByType to cache php?
Whatever Content‑Type your PHP scripts are generating. text/html
if they're generating HTML pages, for instance.
A better option is usually to generate Expires headers in PHP code.
(by Qiao、Lithilion、user149341)