Inoodlest
2015-04-29 14:24
报错
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}
--------------------------------------
刚接触,自己解决不了了
time() 先赋值给变量,然后再 assign
MVC架构模式分析与设计
82396 学习 · 929 问题
相似问题
回答 1
回答 4