In order to reduce the HTTP request, we often need to merge and compress multiple JS and CSS files, the following record on the Internet to implement this function of PHP source code and open source project Minify use method
First, the implementation of merging and compressing multiple JS and CSS file code, please refer to
1. Quickly merge JS and CSS files with one sentence command
2, PHP merge multiple js and CSS files, reduce the HTTP request (prototype)
Second, the use of Minify method
1, download the latest version from code.google.com/p/minify/Minify and unzip, the "Min" folder together with the contents of the copy into the Document_root directory (that is, the site and directory).
You can modify the folder name "Min"
2. Configure the G parameter in "min/groupsconfig.php"
Return Array (
' js ' = = Array ('//js/file1.js ', '//js/file2.js '),
' css ' = = Array ('//css/file1.css ', '//css/file2.css '),
);
3, in the Web page according to the following way to refer to:
The following numbers can be marked with the updated date, and the "min" corresponds to the name in step 1.
4, performance optimization, please refer to Code.google.com/p/minify/wiki/cookbook
Attention:
1, need to httpd.conf in the Rewrite_module module to open
2, the development process, you can open the debug mode, after the development of the debugging mode is closed, you can use the Firebug Firefox browser to view
$min _allowdebugflag true
http://www.bkjia.com/PHPjc/771652.html www.bkjia.com true http://www.bkjia.com/PHPjc/771652.html techarticle In order to reduce the HTTP request, we often need to merge and compress a number of JS and CSS files, the following record online on the implementation of this function of PHP source code and open source project Minify use method One, real ...