首页 / PHP / 关于smarty有关问题,求!多谢!
关于smarty有关问题,求!多谢!
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了关于smarty有关问题,求!多谢!,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2780字,纯文字阅读大概需要4分钟。
内容图文
![关于smarty有关问题,求!多谢!](/upload/InfoBanner/zyjiaocheng/214/70def83054ed45e6b0cdac3294910a28.jpg)
求各位高手指点!不胜感激!!!
第一次接触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}>
------解决方案--------------------
没有设置timezone,打开的php.ini文件修改
date.timezone=Asia/Shanghai,然后重启webserver
------解决方案--------------------
那是因为没有设置默认时区,在PHP文件开头加上:
- PHP code
date_default_timezone_set('PRC');
------解决方案--------------------
或者这样
![](http://www.gxlcms.com/Public/aiod/ts.jpg)
PHP教程热搜
- php中$_SESSION获取不到值怎么办
- php 如何修改图片像素大小
- php date如何转换时间戳
- PHP如何替换数组中的指定元素
- php5ts.dll找不到怎么办
- php如何多个字符串一次替换
- php如何判断文件是不是图片
- php 给数组增加键值对
- php正则如何替换a标签
- php base64转换成图片的方法
- php如何去除回车
- 苹果系统安装php环境的方法详解
- php怎么实现数组随机且不重复
- php do while用法详解
- 教你用PHP开发微信公众号文章付费阅读功能
- php字符串太长怎么办
- php fbclient.dll 丢失怎么办
- php如何实现big5转utf8
- php如何增加字段
- php如何获取调用方法名
- 如何卸载源码安装的php
- php smtp发送邮件失败怎么办
- php如何把数字转成大写字母
- php如何实现下载并修改文件名称
- php找不到数据库怎么办
![](http://www.gxlcms.com/ad/tx500x500.jpg)