PHP动态输出JavaScript代码实例_php实例
程序员文章站
2024-02-04 10:15:22
...
直接上代码:
$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;