做到time()的時候出問題了
報錯
Notice: Undefined index: time in?D:\tools\xampp\htdocs\MVC\smarty\sysplugins\smarty_internal_templatebase.php(171) : eval()'d code?on line?27
Notice: Trying to get property of non-object in?D:\tools\xampp\htdocs\MVC\smarty\sysplugins\smarty_internal_templatebase.php(171) : eval()'d code?on line?27
這是代碼test.php
<?php
require('../smarty/Smarty.class.php');
$smarty = new Smarty();
//配置
$smarty->left_delimiter="{";
$smarty->right_delimiter="}";
$smarty->template_dir="tpl";
$smarty->compile_dir="template_c";
$smarty->cache_dir="cache";
$smarty->caching=true;
$smarty->cache_lifetime=120;
$smarty->assign('time',time());
$smarty->display('test.tpl');
--------------------------------------
這是 test.tpl
{$time}
--------------------------------------
剛接觸,自己解決不了了
2015-04-30
time() 先賦值給變量,然后再 assign