清理smarty缓存

2014.11.4 清理smarty缓存已关闭评论

<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 14-11-4
* Time: 下午1:41
* 清除smarty  生成的temp文件(可多次执行)
*/
date_default_timezone_set("Asia/Shanghai");

set_time_limit(0);
ini_set('memory_limit', '200000M');

include_once dirname(dirname(__FILE__)) . '/Main.php';
$clear = new  del_smarty_temp();
$clear->clear_temp();

class del_smarty_temp {

public  function clear_temp(){
$publicLib           = dirname(WEB_ROOT) . DS . 'public_lib';
$publicCache      = dirname(WEB_ROOT) . DS . 'public_cache';
$smartyDir           = $publicLib . DS . 'smarty';
$smartyCompileDir = $publicCache . DS . 'j*b' . DS . 'thems_c';

include_once $smartyDir . DS . 'Smarty.class.php';
$smarty = new Smarty;
$smarty->compile_dir          = $smartyCompileDir . DS;

$smarty->clear_compiled_tpl(); //主要函数
$smarty->force_compile = true;
$smarty->compile_check = true;

}

}

评论已关闭。