關於smarty有關問題,求!多謝!

來源:互聯網
上載者:User
關於smarty問題,求高手指點!!謝謝!!
求各位高手指點!不勝感激!!!

第一次接觸smarty,第一次使用時報錯;瀏覽器顯示如下: 然而重新整理一下提示資訊就沒有了,瀏覽器還是什麼都沒有輸出!
Strict Standards: strftime() [function.strftime]: It is not safe to rely
on the system's timezone settings. Please use the date.timezone setting,
the TZ environment variable or the date_default_timezone_set() function.
In case you used any of those methods and you are still getting this
warning, you most likely misspelled the timezone identifier. We selected
'UTC' for '8.0/no DST' instead in
C:\AppServ\www\smarty\Smarty\Smarty_Compiler.class.php on line 400


配置如下:
smarty_inc.php
include_once("Smarty/Smarty.class.php"); //包含smarty類檔案
$smarty = new Smarty(); //建立smarty執行個體對象$smarty
$smarty->config_dir="Smarty/Config_File.class.php"; // 目錄變數
$smarty->caching=false; //是否使用緩衝,項目在調試期間,不建議啟用緩衝
$smarty->template_dir = "./templates"; //設定模板目錄
$smarty->compile_dir = "./templates_c"; //設定編譯目錄
$smarty->cache_dir = "./smarty_cache"; //快取檔案夾
//----------------------------------------------------
//左右邊界符,預設為{},但實際應用當中容易與JavaScript相衝突
//----------------------------------------------------
$smarty->left_delimiter = "<{";
$smarty->right_delimiter = "}>";
?>

index.php
include("Smarty_inc.php");
$name="初使smarty";
$smarty->assign("title",$naem);
$smarty->display("index.html");
?>

index.html


<title><br /><body><br /><b><{$title}></b><br /></body><br /></html><br /><br /><br /><br><br />------解決方案--------------------<br />沒有設定timezone,開啟的php.ini檔案修改<br />date.timezone=Asia/Shanghai,然後重啟webserver<br />------解決方案--------------------<br />那是因為沒有設定預設時區,在PHP檔案開頭加上:<br /><dl class='code'>PHP code<pre class="brush:php;toolbar:false">date_default_timezone_set('PRC');<br />------解決方案--------------------<br />或者這樣<br /><dl class='code'>PHP code<pre class="brush:php;toolbar:false"><?date_default_timezone_set('Asia/Shanghai');include_once("Smarty/Smarty.class.php"); ......<br />------解決方案--------------------<br />這不是 smarty 的錯,而是你的php環境沒有設定好<br />php.ini 中 date.timezone 設定時區<br />或在程式中 date_default_timezone_set 函數設定時區 <li ><i class="layui-icon">

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.