问答详情
源自:5-3 Smarty的配置与实例化

smarty compile_id和compile_dir一样不一样呀?


提问者:zhangshuogz 2014-09-05 07:33

个回答

  • PengCheng
    2014-09-05 10:13:53

    不一样,compile_dir 是设定编译文件目录

    compile_id 是让smarty从不同的模板目录找出需要的模板文件来编译


    因为smarty的模板目录改变之后,并不能让smarty自动重新编译模板,必须手动清理编译缓存,才能让smarty重新编译。而改变了compile_id之后,就可以让smarty重新去寻找新模板编译。


    例如

    $template_path="tpl/".$bk_lang."/";

    $smarty=new Smarty();

    $smarty->compile_dir ="./smarty_c";

    $smarty->compile_id =$bk_lang ;

    $smarty->template_dir=$template_path;