WordPress开发函数cache_javascript_headers()

WordPress开发函数cache_javascript_headers()

1245
2021-04-06 10:10:10

WordPress开发函数cache_javascript_headers(),使用JavaScript内容类型设置10天的缓存头。

用法:

cache_javascript_headers()

来源

文件: wp-includes/functions.php

function cache_javascript_headers() {

$expiresOffset = 10 * DAY_IN_SECONDS;

header( 'Content-Type: text/javascript; charset=' . get_bloginfo( 'charset' ) );

header( 'Vary: Accept-Encoding' ); // Handle proxies.

header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + $expiresOffset ) . ' GMT' );

}

更新日志:

WordPress开发函数cache_javascript_headers() (https://www.wpzt.net/) WordPress开发教程 第1张

喜欢这个文章就点个赞分享给好友吧~

END

发表回复

一次支付终身使用
免费版本更新
靠谱的技术支持