cache_javascript_headers

函式
cache_javascript_headers ( No parameters )

cache_javascript_headers: 這個函式是用來在客戶端快取JavaScript頭資訊的。它不接受任何引數,也不返回任何東西。

用JavaScript內容型別設定快取10天的標頭檔案。

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' );
}

常見問題

FAQs
檢視更多 >