私のPHPコード:
$expires_date = date('D, j F Y H:i:s', strtotime('now + 10 years')) . ' GMT';
header("Expires: $expires_date");
header('Content-type: text/javascript');
echo 'hello world';
応答ヘッダーを確認すると、次のように表示されます。
Expires:Thu, 01 Jan 1970 00:00:00 GMT
私は何を間違っていますか?
アップデート:
ただ実験していたのですが、 Expires の設定を解除することさえできないようですheader_remove('Expires');
。まだ1970年の日付が見えます。
アップデート:
私の応答ヘッダー:
Cache-Control:private
Connection:Keep-Alive
Content-Encoding:gzip
Content-Length:74
Content-Type:text/javascript
Date:Wed, 17 Oct 2012 22:40:45 GMT
Expires:Thu, 01 Jan 1970 00:00:00 GMT
Keep-Alive:timeout=5, max=98
Server:Apache/2.2.21 (Win32) PHP/5.3.9
Vary:Accept-Encoding
X-Powered-By:PHP/5.3.9