日期:2014-05-17  浏览次数:20419 次

smarty的compile_dir 路径问题
根目录下有templates templates_c configs cache文件夹 下面代码为何报错?

Fatal error: Smarty error: the $compile_dir '/templates_c/' does not exist, or is not a directory. 




------解决方案--------------------
这个目录应该是没有的吧 /templates_c/ 表示你的系统的根目录,而不是你当前网站的根目录
------解决方案--------------------
应该是php无法访问到根目录,
看看php.ini设定,是不是开启safe_mode的缘故。
------解决方案--------------------
/templates_c/
根目录没有这个目录

------解决方案--------------------
templates_c/ 目录不存在
可能原因是目前指向错误,
echo $smarty-> $compile_dir;
看看路径是什么?然后看看是否真的存在这样的目录。
------解决方案--------------------
编译目录找不到,可以指定一下的
你可以打印出来看看你的编译目录名称 对应一下是否真的存在
------解决方案--------------------
在生成smarty类的实例后指定一个模板缓存目录,即你的例子中的template_c,要保证这个目录是相对于你目前文件的
------解决方案--------------------

------解决方案--------------------
查看smarty的templates_c指向
------解决方案--------------------
/aa/bb 这个是绝对路径,不是相对路径,而且你最好用绝对路径
你可以使用
$_SERVER['DOCUMENT_ROOT']."/templates_c/" 这个样子来表示当前网站的根目录的templates_c 这个目录(虚拟主机)。
------解决方案--------------------
今天刚写了个配置smarty的教程,你参考参考吧!http://hi.baidu.com/hdxiaopihai/blog/item/e8a859f0c99311a7a50f5230.html