关于smarty有关问题,求!多谢!
程序员文章站
2022-04-07 17:09:31
...
关于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
------解决方案--------------------
没有设置timezone,打开的php.ini文件修改
date.timezone=Asia/Shanghai,然后重启webserver
------解决方案--------------------
那是因为没有设置默认时区,在PHP文件开头加上:
求各位高手指点!不胜感激!!!
第一次接触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
------解决方案--------------------
没有设置timezone,打开的php.ini文件修改
date.timezone=Asia/Shanghai,然后重启webserver
------解决方案--------------------
那是因为没有设置默认时区,在PHP文件开头加上:
- PHP code
date_default_timezone_set('PRC');
------解决方案--------------------
或者这样
- PHP code
date_default_timezone_set('Asia/Shanghai'); include_once("Smarty/Smarty.class.php"); ......
------解决方案--------------------
这不是 smarty 的错,而是你的php环境没有设置好
php.ini 中 date.timezone 设置时区
或在程序中 date_default_timezone_set 函数设置时区相关文章
相关视频