ThinkPHP5 清除runtime缓存文件


  • /**  
  •  * 清除模版缓存 不删除cache目录  
  •  */  
  • public function clear_sys_cache() {  
  • Cache::clear();  
  • $this->success( '清除成功', 'index/index' );  
  • }  
  • /**  
  •  * 清除模版缓存 不删除 temp目录  
  •  */  
  • public function clear_temp_ahce() {  
  • array_map( 'unlink', glob( TEMP_PATH.DS.'.php' ) );  
  • $this->success( '清除成功', 'index/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( '清除成功', 'index/index' );  
  • }  
  • /**  
  •  * 清除glob  
  •  */  
  • function clert_temp_cache()  
  • {  
  •     array_map('unlink', glob(TEMP_PATH . '/*.php'));  
  •     rmdir(TEMP_PATH);  

  • 免责声明!

    本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



     
    粤ICP备18138465号  © 2018-2025 CODEPRJ.COM