PHP动态输出JavaScript代码实例
程序员文章站
2022-11-15 12:48:43
直接上代码:
$url = $this->getconfig ()->url ();
$content = "var url={ base:'{$u...
直接上代码:
$url = $this->getconfig ()->url (); $content = "var url={ base:'{$url->base}',css:'{$url->css}',js:'{$url->js}',img:'{$url->img}',current:window.location};"; $expire = 604800; header ( 'content-type: application/x-javascript' ); header ( 'cache-control: max-age=' . $expire ); header ( 'accept-ranges: bytes' ); header ( 'content-length: ' . strlen ( $content ) ); echo $content;