smarty的compile_dir 路徑有關問題
來源:互聯網
上載者:User
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