Thinkphp Method for disabling caching

Source: Internet
Author: User

During the development phase using thinkphp, the program is often modified. If you do not disable the cache, this may cause a lot of unnecessary troubles, such as modifying the table structure, you must delete the data structure cache to see the effect. For the convenience of development, you can disable the default cache of thinkphp and enable it later.

How can I disable the thinkphp cache? You can refer to the following methods:

(1) Disable caching in the configuration file

Add the following two sentences to the config. php file:

'Tmpl _ CACHE_ON '=> false, // disable template compilation cache 'html _ CACHE_ON' => false, // disable static Cache

(2) Disable all caches in the entry file

Add the following code to the entry file:

Define ('app _ debug', TRUE); // enable the DEBUG mode define ('db _ FIELD_CACHE ', false); define ('html _ CACHE_ON', false ); // www.phpernote.com/

(3) modify the default value of the program
 
1. Find the \ ThinkPHP \ Common \ convention. php and \ ThinkPHP \ Common \ debug. php files.
 
2. Open these two files and modify them as follows:

Convention. php file:

'Tmpl _ CACHE_ON '=> false, // If the template compilation cache is enabled by default, false is used to re-compile the template 'Action _ CACHE_ON' => false, // by default, 'html _ CACHE_ON '=> false is disabled. // static cache is disabled by default.

Debug. php file:

'Tmpl _ CACHE_ON '=> false, // The template cache is enabled by default.

After the above modification, a new cache will be generated every time the program runs.

Articles you may be interested in
  • Thinkphp automatic verification and automatic filling are invalid Solutions
  • ThinkPHP built-in template engine usage Summary
  • Summary of system constants in the Action controller of thinkphp
  • How does thinkphp remove index. php from the url?
  • Debugging methods required for using ThinkPHP
  • Thinkphp intercepts Chinese strings
  • How to set the jump wait time for the thinkphp page Jump (successerror)
  • Thinkphp development skills

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.