<?php//php js css load Merge function Song Jong finishing//reprint please specify the source define (' Combine_js ', true);d efine (' Combine_css ', true); define (' Application_js_root ', ' e:/wwwroot/m/js/');d efine (' application_css_root ', ' e:/wwwroot/m/css/'); define (' Sc_root ', ' e:/wwwroot/m/static_cache/');d efine (' Sc_url ', ' http://www.localhost.com/m/static_cache/ define (' Application_js ', ' http://www.localhost.com/m/js/');d efine (' application_css ', ' http:// www.localhost.com/m/css/'); function load_combine_js ($js, $path =array (), $origin =false, $part =1) { if (!is_array ($JS)) return false; if (Empty ($path)) { $path _url=application_js; $path _root=application_js_root; } if ($origin or (! COMBINE_JS)) { $string = "; for ($i =0; $i <coUNT ($JS); $i + +) {$string. = ' <script src= ' {$path _url}{$js [$i]}.js ' ></script>\n ';} echo $string; return true; } $cache _filename= ' js-'. MD5 ($_server[' Script_name ']. $part). '. JS '; if (!file_exists (sc_root. $cache _filename)) { $file _content= '; for ($i =0; $i <count ($JS); $i + +) { $f = $path _root. $js [$i]. '. JS '; if (file_exists ($f)) $file _ Content.=file_get_contents ($f). " \ n "; } file_put_ Contents (sc_root. $cache _filename, $file _content); } $file =sc_uRL. $cache _filename; echo "<script src= ' {$file} ' ></script>\n"; return true;} function load_combine_css ($css, $path =array (), $origin =false, $part =1) { if (!is_ Array ($CSS)) return false; if (Empty ($path)) { $path _url=application_css; $path _root= Application_css_root; } if ($origin or (! COMBINE_CSS)) { $string = "; for ($i =0; $i <count ($CSS); $i + +) {$string. = ' <link href= ' {$path _url}{$css [$i]}.css ' rel = ' stylesheet ' type= ' text/css ' />\n ';} echo $string; return true; } $cache _filename= ' css-'. MD5 ($_server[' Script_name ']. $part). CSS '; if (!file_exists (sc_root. $cache _filename)) { $file _content= '; for ($i =0; $i <count ($CSS); $i + +) { $f = $path _root. $css [$i]. '. CSS '; if (file_exists ($f)) $file _ Content.=file_get_contents ($f). " \ n "; } file_put_ Contents (sc_root. $cache _filename, $file _content); } $file =sc_url. $cache _filename; echo $string = "<link href= ' {$file} ' rel= ' stylesheet ' type= ' text/css ' />\n "; return true;} ?><! doctype html public "-//w3c//dtd&nbSp xhtml 1.0 transitional//en " " HTTP://WWW.W3.ORG/TR/XHTML1/DTD/XHTML1-TRANSITIONAL.DTD ">< html xmlns= "http://www.w3.org/1999/xhtml" > PHP js CSS load merge function Song Jong collation