将有JavaScript类型的页头缓存10天
描述
设置页头,将有JavaScript类型的页头保存十天。
用法
<?php cache_javascript_headers() ?>
参数
None.
返回值
(void)
此函数不返回值。
历史
添加于 版本: 2.1.0
源文件
cache_javascript_headers() 函数的代码位于 wp-includes/functions.php
.
/* ———————————-
* wordpress函数 zz2zz.com收集
* ———————————- */
/**
* Set the headers for caching for 10 days with JavaScript content type.
*
* @since 2.1.0
*/
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” );
}