如何从PHP中的date()修复警告“ [英] How to fix warning from date() in PHP"

查看:134
本文介绍了如何从PHP中的date()修复警告“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在winxp上使用XAMPP(PHP 5.3.1版)。当我尝试在本地主机上调用time()或date()函数时。这将显示警告信息,


严重性:警告



消息: date()[function.date]:它是
不安全依靠系统的
时区设置。您需要
以使用date.timezone设置或
date_default_timezone_set()
函数。如果您使用任何
这些方法,您仍然
得到此警告,您很可能
拼写时区标识符。我们
为'8.0 / no DST'
选择'UTC'



文件名:helpers / date_helper.php


如何禁用警告?谢谢。

解决方案

尝试在<$ c中设置 date.timezone $ c> php.ini 文件。或者您可以使用 ini_set() date_default_timezone_set()手动设置。


I am using XAMPP(PHP Version 5.3.1) on winxp. When I try to call time() or date() function on my localhost. It will show warning message as this,

Severity: Warning

Message: date() [function.date]: It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting 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

Filename: helpers/date_helper.php

How can I disable the warning? Thanks.

解决方案

Try to set date.timezone in php.ini file. Or you can manually set it using ini_set() or date_default_timezone_set().

这篇关于如何从PHP中的date()修复警告“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆