PHPDocumentor 日期问题警告

发布于 2024-08-15 06:39:22 字数 1331 浏览 3 评论 0原文

我在使 phpdoc 正确运行时遇到一些问题。文档大部分已成功生成,但我多次收到以下警告:

警告:日期():不安全 依赖系统的时区 设置。您需要使用 date.timezone 设置或 date_default_timezone_set() 函数。 如果您使用任何这些方法 你仍然得到这个 警告,您很可能拼写错误 时区标识符。我们选择了 'America/Los_Angeles' 表示 'PST/-8.0/no DST' 改为 /Users/ben/bin/PhpDocumentor/phpDocumentor/Converter.inc 在线 5064

警告:strftime():不安全 依赖系统的时区 设置。您需要使用 date.timezone 设置或 date_default_timezone_set() 函数。 如果您使用任何这些方法 你仍然得到这个 警告,您很可能拼写错误 时区标识符。我们选择了 'America/Los_Angeles' 表示 'PST/-8.0/no DST' 改为 PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/Smarty_Compiler.class.php 第 370 行

Smarty 警告我可以轻松地从代码中删除,因为它只是在渲染文档中的模板顶部生成时间戳。没什么大不了的。我不确定 phpDocumentor 中的第一个错误。似乎只是为模板分配一个日期给 Smarty:

$templ->assign("date",date("r",time()));

也许我可以删除 Smarty 模板和这一行中的所有“日期”变量。

不管怎样,这个警告也出现在生成的文档中,索引页只显示这个警告。你知道这里发生了什么吗?我使用的是 1.4.3 版本,这是我的标志/选项:

#!/usr/bin/env bash
phpdoc \
    --title 'Asra Documentation' \
    --directory library/Asra \
    --target docs \
    --defaultcategoryname Asra \
    --defaultpackagename Asra \
    --quiet on \
    --output HTML:frames:phpedit

I'm having some issues getting phpdoc to run correctly. The docs are being generated for the most part successfully, but I get the following warning many times:

Warning: 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
'America/Los_Angeles' for 'PST/-8.0/no
DST' instead in
/Users/ben/bin/PhpDocumentor/phpDocumentor/Converter.inc
on line 5064

and

Warning: strftime(): 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
'America/Los_Angeles' for 'PST/-8.0/no
DST' instead in
PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/Smarty_Compiler.class.php
on line 370

The Smarty warning I could easily remove from the code since it's just generating a timestamp at the top of the template in the rendered document. No biggie. The first error in the phpDocumentor I'm not sure about. Seems to be just assigning a date to Smarty for the template:

$templ->assign("date",date("r",time()));

Maybe I could just remove all the "date" variables in the Smarty templates and this line.

Anyway, this warning is in the generated docs as well and the index page just displays this warning. Any ideas what is happening here? I'm using version 1.4.3 and here are my flags/options:

#!/usr/bin/env bash
phpdoc \
    --title 'Asra Documentation' \
    --directory library/Asra \
    --target docs \
    --defaultcategoryname Asra \
    --defaultpackagename Asra \
    --quiet on \
    --output HTML:frames:phpedit

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

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

发布评论

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

评论(1

青春如此纠结 2024-08-22 06:39:22

这就是 PHP 5.3 的作用。 PHP 5.3+ 要求您设置时区,原因如下(依赖系统设置是不安全的)。

如果可以的话,只需在 bootstrap/init/settings 文件中调用 date_default_timezone_set() 即可。您还可以在 .htaccess 文件中指定以使其成为对于您的代码来说不是问题,如下所示:

php_value date.timezone America/Vancouver

This is PHP 5.3 at work. PHP 5.3+ demands that you set your timezone, for the reasons given (relying on the system settings is unsafe).

If you can, just call date_default_timezone_set() in your bootstrap/init/settings file. You can also specify it in an .htaccess file to make it a non-issue for your code, like this:

php_value date.timezone America/Vancouver
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文