PHP, JS and CSS optimization tools minify use _php Tutorial

Source: Internet
Author: User
Tags php source code
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 ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.