thinkphp clearing Cache Runtime files

Source: Internet
Author: User

Thinkphp generated cache files in the project directory in the runtime directory, in some cases, the browser and program cache for debugging has a great impact on the production of data within the system has a great impact, then how to delete the thinkphp cache?

Directly on the code bar, this is very simple, is through the code to the runtime files under the file loop Delete.

    Clear Cache--delete RUNTIME folder public    function Delrun () {        $R = Runtime_path;        Execute the Delete function        if ($this->_deletedir ($R))            $this->success (' Delete succeeded! ');            Die ("Clear success!");    }    Private Function _deletedir ($R) {        //Open a directory handle        $handle = Opendir ($R);        Read the directory until there is no directory while        (($item = Readdir ($handle))!== false) {            //skip ... Two special Directories            if ($item! = '. ' and $item! = ' ... ') {                //If you traverse to a directory                if (Is_dir ($R. '/'. $item)) {                    //continue to traverse the directory                    $this->_deletedir ($R. '/'. $item);                } else{                    //If it is not a directory, delete the file                    if (!unlink ($R. '/'. $item)) Die                    (' error! ');        }} Close directory        closedir ($handle);        Delete Empty directory        return rmdir ($R);    }

 

------------------------Reprint Please specify the source-----------------------

-----------------------qq:297760026-----------------------

-----------------------www.sl95.cn-----------------------

thinkphp clearing Cache Runtime files

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.