tp5.0清除緩沖
阿新 • • 發佈:2018-01-19
$path control rmdir code clear cti nds func ear namespace app\admin\controller;
use think\Cache;
class Caches extends Base{
public function clear_sys_cache() {
use think\Cache;
class Caches extends Base{
public function clear_sys_cache() {
Cache::clear(); $this->success( ‘清除成功‘, ‘admin/entry/index‘ ); } /** * 清除模版緩存 不刪除 temp目錄 */ public function clear_temp_ahce() { array_map( ‘unlink‘, glob( TEMP_PATH.DS.‘.php‘ ) ); $this->success( ‘清除成功‘, ‘admin/entry/index‘ ); } /** * 清除日誌緩存 不刪出log目錄 */ public function clear_log_chache() { $path = glob( LOG_PATH.‘/‘ ); foreach ($path as $item) { array_map( ‘unlink‘, glob( $item.DS.‘.‘ ) ); rmdir( $item ); } $this->success( ‘清除成功‘, ‘admin/entry/index‘ ); } //清除模板緩存 public function clert_temp_cache() { // array_map(‘unlink‘, glob(TEMP_PATH . ‘/*.php‘)); // rmdir(TEMP_PATH); $a=glob(TEMP_PATH . ‘\*.php‘); // halt($a); if(!empty($a)){ array_map(‘unlink‘, $a); rmdir(TEMP_PATH); $this->success(‘清除成功:)‘,‘admin/entry/index‘); } // $this->success(‘清除成功:)‘,‘admin/entry/index‘); }
}
tp5.0清除緩沖