How does one set thinkphp static pages for static caching? Static

Source: Internet
Author: User
Thinkphp static cache setting instance and static setting instance. An Html folder is directly generated under the Project Directory. It contains the static cache setting instance of thinkphp, which is a static cache setting instance. An Html folder is directly generated under the Project Directory. It contains static cached files. The configuration in conf/config. php is as follows. Some people say they want to write an htmls. php file. I tried to implement it. Later, the thinkphp Forum received the following settings:
// Static cache
'HTML _ CACHE_ON '=> true,
'HTML _ cache_rules' => array (
'*' => Array ('{: action }_{ id}', 60)
),
In the above example, the cache is generated by the entire site, and the cache is generated by the background. Therefore, we need to set each Class:
// Static cache
'HTML _ CACHE_ON '=> true,
'HTML _ cache_rules' => array (
'About: '=> array (' {: action }_{ id} ', 60 ),
'Anli: '=> array (' {: action }_{ id} ', 60 ),
'Fangan: '=> array (' {: action }_{ id} ', 60 ),
'Index: '=> array (' {: action }_{ id} ', 60 ),
'Link: '=> array (' {: action }_{ id} ', 60 ),
'News: '=> array (' {: action }_{ id} ', 60 ),
'Product: '=> array (' {: action }_{ id} ', 60 ),
'Zkuser: '=> array (' {: action }_{ id} ', 60 ),
In front of the class name on my website. if you want to define the method about, you can write the method name later. 60 indicates 60 seconds of cache. {: Action} _ id indicates the method name _ id. in this way, my cache is successfully generated, but the access path remains unchanged. The static page is accessed directly, and thinkphp is redirected directly. If you want to let the user know that it is. html, we can enable a pseudo-static setting based on this: 'URL _ HTML_SUFFIX '=> '.html'. below is the page record of thinkphp:
First, you can copy the custom Page import ("@. Action. ORG. Page") by referring to the example provided by thinkphp. import the Page class @ refers to the lib folder in the working directory.
Note:
1. Change $ _ GET [C ('Var _ page')] in page. class. php to a self-passed parameter, for example, $ _ GET ['P'].
2. you can view the code of the zk folder by adding a piece of code to the 'preview' and 'next' in the program.
If (empty ($ _ GET ['P']) {
$ P-> firstRow = 0;
} Else {
$ P-> firstRow = ($ _ GET ['P']-1) * 13;
}

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.