DoY*_*ite 0 php .htaccess header
我们可以通过将它放在我们的.htaccess上来操纵我们的过期日期
ExpiresDefault "access plus 10 years"
Run Code Online (Sandbox Code Playgroud)
我们希望在PHP文件中操作它.在寻找类似的东西时.我遇到了:
$offset = 60 * 60;
$expire = 'expires: ' . gmdate ('D, d M Y H:i:s', time() + $offset) . ' GMT';
header ($expire);
Run Code Online (Sandbox Code Playgroud)
但这只会增加我们过期日期的时间.为了我们; 我们希望这一年有所改变.在PHP中有这种方法吗?
你可以这样做:
$expire = 'Expires: ' . gmdate('D, d M Y H:i:s', strtotime('+10 years')) . ' GMT';
header($expire);
Run Code Online (Sandbox Code Playgroud)
我strtotime用来创建当前时间+ 10年的时间戳.
| 归档时间: |
|
| 查看次数: |
1692 次 |
| 最近记录: |