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
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.