php.ini报错问题

发布于 2024-11-10 16:31:08 字数 363 浏览 2 评论 0原文

我收到此错误: Warning: date() [function.date]: It is not safe to dependent on the system's timezone settings.

php.ini 我有错误报告设置为 error_reporting = E_ALL & ~E_NOTICE

知道如何摆脱这些警告吗?

编辑:
我想修复错误报告,因为出现了其他类型的警告。
编辑2:
所有警告均与 date.timezone 相关。

谢谢。

I get this error: Warning: date() [function.date]: It is not safe to rely on the system's timezone settings.

In php.ini I have error reporting set as error_reporting = E_ALL & ~E_NOTICE.

Any idea how I can get rid of those warnings?

EDIT:
I want to fix the Error Reporting as there's other kinds of Warnings showing up.

EDIT 2:
All warnings were date.timezone related.

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

酒浓于脸红 2024-11-17 16:31:08

php.ini 文件中找到此部分:

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Some/Timezone

取消注释(删除 ;)并将其更改为正确的时区。有关支持的时区列表: http://php.net/manual/en/timezones.php< /a>

Find this section in the php.ini file:

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Some/Timezone

Uncomment it (remove the ;) and change it to be the correct timezone. For a list of supported timezones: http://php.net/manual/en/timezones.php

云淡月浅 2024-11-17 16:31:08

查找:

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
; date.timezone = America/Los_Angeles

并取消注释此行:

date.timezone = America/Los_Angeles

并选择您的时区...

Look for:

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
; date.timezone = America/Los_Angeles

and Uncomment this line:

date.timezone = America/Los_Angeles

And choose your time zone...

紧拥背影 2024-11-17 16:31:08

您可以使用 @ 运算符捕获该警告。我认为关闭警告是不明智的

you could just catch that warning using the @ operator. Turning off warnings is ill advised in my view

夕嗳→ 2024-11-17 16:31:08
Try this code in your php file.
date_default_timezone_set('America/Los_Angeles');
URL: http://www.php.net/manual/en/function.date-default-timezone-set.php
Try this code in your php file.
date_default_timezone_set('America/Los_Angeles');
URL: http://www.php.net/manual/en/function.date-default-timezone-set.php
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文