PHP动态输出JavaScript代码实例,phpjavascript
程序员文章站
2022-04-27 17:21:00
...
PHP动态输出JavaScript代码实例,phpjavascript
直接上代码:
$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;
上一篇: 开学大四,自动化专业想转行做程序员,现在该从何学起?
下一篇: php实现邮件发送并带有附件