1. 首页
  2. WordPress 函数手册

cache_javascript_headers()

cache_javascript_headers()

使用JavaScript内容类型设置缓存头10天。
Set the headers for caching for 10 days with JavaScript content type.

目录锚点:#返回#源码


返回(Return)

无返回值


源码(Source)

/**
 * 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" );
}
更新版本 源码位置 使用 被使用
2.1.0 wp-includes/functions.php:1486 0 1 function

cache_javascript_headers() 为WP2原创文章,链接:https://www.wp2.cn/functions/cache_javascript_headers/