Posted in PHP onNovember 01, 2013
看代码就会的小例子:php合并js请求
//页面保存为js.php //前台请求范例http://localhost/js.php?f=1,2 //请求1.js,2.js两个文件 <?PHP header("Content-Type:application/x-javascript"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: max-age=".(86400*30)); header("Expires: " .gmdate("D, d M Y H:i:s",time()+86400*30). " GMT"); if($_GET['f']) { $url = parse_url($_SERVER['REQUEST_URI']); $arr_f = array_unique(explode(',',preg_replace("/\.+\//",'',$_GET['f']))); foreach($arr_f as $v) { if(!empty($v)) { include('./'.$v.'.js'); echo "\n"; } } } ?>
php合并js请求的例子
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@