查看: 843|回复: 1
|
[PHP] 用 date() 安全性问题
[复制链接]
|
|
- error_reporring(E_ALL | E_STRICT);
- echo date('d-m-y');
复制代码
ouput 的warning:
Strict Standards: date() [function.date]: 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
这代表直接用 date() 不安全吗?? 要怎样才好?? |
|
|
|
|
|
|
|
发表于 8-2-2007 12:21 PM
|
显示全部楼层
原帖由 kenyi 于 8-2-2007 11:30 AM 发表
error_reporring(E_ALL | E_STRICT);
echo date('d-m-y');
ouput 的warning:
这代表直接用 date() 不安全吗?? 要怎样才好??
并不是说不安全,只要你把那个 E_STRICT 去掉就没事
因为以前时间 depend on server 所以在 php 5 有新的 function 就是不用再 depend server time
偶尔会错误可能
就这样简单
[ 本帖最后由 cupid25 于 8-2-2007 12:22 PM 编辑 ] |
|
|
|
|
|
|
| |
本周最热论坛帖子
|