【发布时间】:2017-06-12 09:41:11
【问题描述】:
我有一个我正在使用的 PHP 书签脚本,它从我的书签构建一个 RSS 提要(脚本是 Semantic Scuttle)。 RSS 中的每个项目如下所示。
<item>
<title>Technology and the Evolution of the Designer’s Role</title>
<link>https://blogs.adobe.com/creativecloud/technology-and-the-evolution-of-the-designers-role</link>
<guid>http://apps.timpaneeze.com/bookmarks/www/#7</guid>
<description>Today, we often associate design with activities like user experience, graphic and web design, or perhaps fashion and product design. Mass communications and mass production brought with them the need for specific skills in creating posters and products. Each wave of technological change brings with it an evolution in the role and activities that designers undertake.</description>
<dc:creator>bobroberts</dc:creator>
<pubDate>Fri, 27 Jan 2017 00:05:50 +0000</pubDate>
<category>design</category>
</item>
发布日期与我在系统中实际创建书签的时间不匹配,并且没有 UI 可以更改它。我在网上找到了使用strtotime($row['bDatetime']) - 60 * 60 * 14 更改时间的建议(一个帖子是 14 小时休息)。不过,这实际上并没有确定日期。对于某些项目,结果时间是正确的,但对于其他项目则不正确。
我还将 RSS 提要项目拉入 WordPress,在那里时间变得更加糟糕。 WP 带来了该 RSS 项目,未来发布时间为 2017 年 1 月 26 日 18:05。该 WP 安装设置为洛杉矶(太平洋)时区。
所以,快速回顾一下:
- 我在太平洋时间 10:05 创建书签
- 书签系统将该创建时间标记为当天 05:05
- WP 将在同一天 18:05 导入
- 使用
strtotime($row['bDatetime']) - 60 * 60 * 5并不能可靠地修复每个 pubDate
如何使这些匹配?
发布日期中的 +0000 是关键吗?如果是这样,我该如何修改?
发布日期出现在书签脚本文件中的唯一位置是这里。您可以在最后看到原始行以及我在顶部尝试修复它的失败尝试:
$_pubdate = gmdate('r', strtotime($row['bDatetime']) - 60 * 60 * 14);
/* PSB EDIT Replaced below line with above. */
/* $_pubdate = gmdate('r', strtotime($row['bDatetime'])); */
【问题讨论】:
-
也试过(没有成功)将下面添加到 php.ini `
php_value date.timezone "America/Los_Angeles" ` -
将
SetEnv TZ America/Los_Angeles添加到.htaccess 也没有效果