首页 > 其他 > 详细

tp5.0清除缓冲

时间:2018-01-19 15:31:44      阅读:239      评论:0      收藏:0      [点我收藏+]
namespace app\admin\controller;
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清除缓冲

原文:http://blog.51cto.com/13579724/2062884

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!