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