{"id":245,"date":"2013-08-16T14:35:02","date_gmt":"2013-08-16T06:35:02","guid":{"rendered":"http:\/\/www.zyuns.com\/?p=245"},"modified":"2015-02-15T20:49:41","modified_gmt":"2015-02-15T12:49:41","slug":"php-chan-sheng-rss-pubdate-suo-xu-ri-qi-shi-jian-ge-shi","status":"publish","type":"post","link":"https:\/\/www.siediyer.cn\/?p=245","title":{"rendered":"PHP\u4ea7\u751fRSS pubDate\u6240\u9700\u65e5\u671f\u65f6\u95f4\u683c\u5f0f"},"content":{"rendered":"<p>RSS\u00a0\/\u00a0ATOM\u00a0\u7684\u683c\u5f0f\u8981\u4ea7\u751f\u90fd\u5f88\u7b80\u5355,\u00a0\u9ebb\u70e6\u7684\u662f\u65e5\u671f\u683c\u5f0f\u7684\u4ea7\u751f(RSS\u00a0=&amp;gt;\u00a0pubDate,\u00a0ATOM\u00a0=&amp;gt;\u00a0created).<\/p>\n<p>RSS \/ ATOM \u7684\u683c\u5f0f\u8981\u4ea7\u751f\u90fd\u5f88\u7b80\u5355, \u9ebb\u70e6\u7684\u662f\u65e5\u671f\u683c\u5f0f\u7684\u4ea7\u751f(RSS =&gt; pubDate, ATOM =&gt; created).<\/p>\n<p>\u53d1\u73b0 PHP Date \u6709\u63d0\u4f9b\u8fd9\u4e9b\u9700\u8981\u7684\u76f8\u5173\u5168\u57df\u53d8\u91cf\u53ef\u4ee5\u4f7f\u7528:(PHP 5.1.1 \u4ee5\u540e\u5f00\u59cb\u652f\u63f4\u8fd9\u4e9b\u5168\u57df\u53d8\u91cf)<\/p>\n<ul>\n<li>echo DATE_RSS; \/\/ D, d M Y H:i:s O<\/li>\n<li>echo DATE_ATOM; \/\/ Y-m-dTH:i:sP<\/li>\n<li>echo date(DATE_RSS); \/\/ Wed, 23 Apr 2008 19:27:19 +0800<\/li>\n<li>echo date(DATE_ATOM); \/\/ 2008-04-23T19:27:38+08:00<\/li>\n<\/ul>\n<p>\u5982\u679c\u662f MySQL timestamp\/datetime format \u76f4\u63a5\u62c9\u51fa\u6765\u7684\u8d44\u6599, \u5c31\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528:<\/p>\n<ul>\n<li>date(DATE_RSS, strtotime($MYSQL_DATETIME_DATA));<\/li>\n<\/ul>\n<p>\u76ee\u524d\u652f\u6301\u7684\u65e5\u671f\u5168\u57df\u53d8\u91cf\u6709\u4ee5\u4e0b:<\/p>\n<ul>\n<li>DATE_ATOM: Atom\u00a0 Atom (example: 2005-08-15T15:52:01+00:00)<\/li>\n<li>DATE_COOKIE: HTTP Cookies (example: Monday, 15-Aug-05 15:52:01 UTC)<\/li>\n<li>DATE_ISO8601: ISO-8601 (example: 2005-08-15T15:52:01+0000)<\/li>\n<li>DATE_RFC822: RFC 822 (example: Mon, 15 Aug 05 15:52:01 +0000)<\/li>\n<li>DATE_RFC850: RFC 850 (example: Monday, 15-Aug-05 15:52:01 UTC)<\/li>\n<li>DATE_RFC1036: RFC 1036 (example: Mon, 15 Aug 05 15:52:01 +0000)<\/li>\n<li>DATE_RFC1123: RFC 1123 (example: Mon, 15 Aug 2005 15:52:01 +0000)<\/li>\n<li>DATE_RFC2822: RFC 2822 (Mon, 15 Aug 2005 15:52:01 +0000)<\/li>\n<li>DATE_RFC3339: Same as DATE_ATOM<\/li>\n<li>DATE_RSS: RSS (Mon, 15 Aug 2005 15:52:01 +0000)<\/li>\n<li>DATE_W3C: World Wide Web Consortium (example: 2005-08-15T15:52:01+00:00)<\/li>\n<\/ul>\n<h2>PHP \u9884\u5b9a\u4e49\u7684\u65e5\u671f\u683c\u5f0f<\/h2>\n<p>\u81ea PHP 5.1.1 \u8d77\u5b9a\u4e49\u6709\u4ee5\u4e0b\u5e38\u91cf\u6765\u63d0\u4f9b\u6807\u51c6\u65e5\u671f\u8868\u8fbe\u65b9\u6cd5\uff0c\u53ef\u4ee5\u7528\u4e8e\u65e5\u671f\u683c\u5f0f\u51fd\u6570<\/p>\n<ul>\n<li>echo DATE_RSS; \/\/ D, d M Y H:i:s O<\/li>\n<li>echo DATE_ATOM; \/\/ Y-m-dTH:i:sP<\/li>\n<li>echo date(DATE_RSS); \/\/ Wed, 23 Apr 2008 19:27:19 +0800<\/li>\n<li>echo date(DATE_ATOM); \/\/ 2008-04-23T19:27:38+08:00<\/li>\n<\/ul>\n<p>\u867d\u7136\u683c\u5f0f\u7b80\u5355, \u4f46\u7528PHP\u5185\u7684\u9884\u5b9a\u4e49\u683c\u5f0f\u5c82\u4e0d\u66f4\u52a0\u65b9\u4fbf.<\/p>\n<p>\u76ee\u524dPHP\u6240\u6709\u652f\u6301\u7684\u65e5\u671f\u683c\u5f0f:<\/p>\n<ul>\n<li>DATE_ATOM: Atom\u00a0 Atom (example: 2005-08-15T15:52:01+00:00)<\/li>\n<li>DATE_COOKIE: HTTP Cookies (example: Monday, 15-Aug-05 15:52:01 UTC)<\/li>\n<li>DATE_ISO8601: ISO-8601 (example: 2005-08-15T15:52:01+0000)<\/li>\n<li>DATE_RFC822: RFC 822 (example: Mon, 15 Aug 05 15:52:01 +0000)<\/li>\n<li>DATE_RFC850: RFC 850 (example: Monday, 15-Aug-05 15:52:01 UTC)<\/li>\n<li>DATE_RFC1036: RFC 1036 (example: Mon, 15 Aug 05 15:52:01 +0000)<\/li>\n<li>DATE_RFC1123: RFC 1123 (example: Mon, 15 Aug 2005 15:52:01 +0000)<\/li>\n<li>DATE_RFC2822: RFC 2822 (Mon, 15 Aug 2005 15:52:01 +0000)<\/li>\n<li>DATE_RFC3339: Same as DATE_ATOM<\/li>\n<li>DATE_RSS: RSS (Mon, 15 Aug 2005 15:52:01 +0000)<\/li>\n<li>DATE_W3C: World Wide Web Consortium (example: 2005-08-15T15:52:01+00:00)<\/li>\n<\/ul>\n<h2>PHP Date \/ Time Functions<\/h2>\n<p><b>PHP<\/b>: indicates the earliest version of PHP that supports the function.<\/p>\n<p>&nbsp;<\/p>\n<table>\n<tbody>\n<tr>\n<th>Function<\/th>\n<th>Description<\/th>\n<th>PHP<\/th>\n<\/tr>\n<tr>\n<td>checkdate()<\/td>\n<td>Validates a Gregorian date<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>date_default_timezone_get()<\/td>\n<td>Returns the default time zone<\/td>\n<td>5<\/td>\n<\/tr>\n<tr>\n<td>date_default_timezone_set()<\/td>\n<td>Sets the default time zone<\/td>\n<td>5<\/td>\n<\/tr>\n<tr>\n<td>date_sunrise()<\/td>\n<td>Returns the time of sunrise for a given day \/ location<\/td>\n<td>5<\/td>\n<\/tr>\n<tr>\n<td>date_sunset()<\/td>\n<td>Returns the time of sunset for a given day \/ location<\/td>\n<td>5<\/td>\n<\/tr>\n<tr>\n<td>date()<\/td>\n<td>Formats a local time\/date<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>getdate()<\/td>\n<td>Returns an array that contains date and time information for a Unix timestamp<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>gettimeofday()<\/td>\n<td>Returns an array that contains current time information<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>gmdate()<\/td>\n<td>Formats a GMT\/UTC date\/time<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>gmmktime()<\/td>\n<td>Returns the Unix timestamp for a GMT date<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>gmstrftime()<\/td>\n<td>Formats a GMT\/UTC time\/date according to locale settings<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>idate()<\/td>\n<td>Formats a local time\/date as integer<\/td>\n<td>5<\/td>\n<\/tr>\n<tr>\n<td>localtime()<\/td>\n<td>Returns an array that contains the time components of a Unix timestamp<\/td>\n<td>4<\/td>\n<\/tr>\n<tr>\n<td>microtime()<\/td>\n<td>Returns the microseconds for the current time<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>mktime()<\/td>\n<td>Returns the Unix timestamp for a date<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>strftime()<\/td>\n<td>Formats a local time\/date according to locale settings<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>strptime()<\/td>\n<td>Parses a time\/date generated with strftime()<\/td>\n<td>5<\/td>\n<\/tr>\n<tr>\n<td>strtotime()<\/td>\n<td>Parses an English textual date or time into a Unix timestamp<\/td>\n<td>3<\/td>\n<\/tr>\n<tr>\n<td>time()<\/td>\n<td>Returns the current time as a Unix timestamp<\/td>\n<td>3<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2>PHP Date \/ Time Constants<\/h2>\n<p>PHP: indicates the earliest version of PHP that supports the constant.<\/p>\n<p>&nbsp;<\/p>\n<table>\n<tbody>\n<tr>\n<th>Constant<\/th>\n<th>Description<\/th>\n<th>PHP<\/th>\n<\/tr>\n<tr>\n<td>DATE_ATOM<\/td>\n<td>Atom (example: 2005-08-15T16:13:03+0000)<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>DATE_COOKIE<\/td>\n<td>HTTP Cookies (example: Sun, 14 Aug 2005 16:13:03 UTC)<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>DATE_ISO8601<\/td>\n<td>ISO-8601 (example: 2005-08-14T16:13:03+0000)<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>DATE_RFC822<\/td>\n<td>RFC 822 (example: Sun, 14 Aug 2005 16:13:03 UTC)<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>DATE_RFC850<\/td>\n<td>RFC 850 (example: Sunday, 14-Aug-05 16:13:03 UTC)<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>DATE_RFC1036<\/td>\n<td>RFC 1036 (example: Sunday, 14-Aug-05 16:13:03 UTC)<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>DATE_RFC1123<\/td>\n<td>RFC 1123 (example: Sun, 14 Aug 2005 16:13:03 UTC)<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>DATE_RFC2822<\/td>\n<td>RFC 2822 (Sun, 14 Aug 2005 16:13:03 +0000)<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>DATE_RSS<\/td>\n<td>RSS (Sun, 14 Aug 2005 16:13:03 UTC)<\/td>\n<td valign=\"top\"><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\">DATE_W3C<\/td>\n<td valign=\"top\">World Wide Web Consortium (example: 2005-08-14T16:13:03+0000)<\/td>\n<td valign=\"top\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5176\u5b83\u76f8\u5173\u7f51\u9875:<\/p>\n<ul>\n<li><a title=\"PHP Date and Time Predefined Constants\" href=\"http:\/\/www.php.net\/manual\/en\/datetime.constants.php\" target=\"_blank\">PHP Date and Time Predefined Constants<\/a><\/li>\n<li><a title=\"PHP Date \/ Time Functions\" href=\"http:\/\/www.w3schools.com\/php\/php_ref_date.asp\" target=\"_blank\">PHP Date \/ Time Functions<\/a><\/li>\n<\/ul>\n<p>\u867d\u7136\u683c\u5f0f\u5f88\u7b80\u5355, \u4f46\u662f\u6709\u66f4\u591a\u5df2\u7ecf\u5199\u597d\u7684 Library \u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528, \u4f1a\u7701\u6389\u4e0d\u5c11\u65f6\u95f4, \u8be6\u53ef\u53c2\u8003:(\u4e0d\u8fc7\u4e0b\u8ff0\u6211\u6ca1\u7528\u8fc7\u5c31\u662f\u4e86.. Orz.)<\/p>\n<ul>\n<li><a title=\"PHP Universal Feed Generator (supports RSS 1.0, RSS 2.0 and ATOM)\" href=\"http:\/\/www.ajaxray.com\/blog\/2008\/03\/08\/php-universal-feed-generator-supports-rss-10-rss-20-and-atom\" target=\"_blank\">PHP Universal Feed Generator (supports RSS 1.0, RSS 2.0 and ATOM)<\/a><\/li>\n<li><a title=\"RSS Generator\" href=\"http:\/\/www.phpclasses.org\/browse\/package\/2569.html\" target=\"_blank\">RSS Generator<\/a><\/li>\n<\/ul>\n<p>RSS Parser \u53ef\u4ee5\u8003\u8651\u7528\u4e0b\u8ff0\u7684<\/p>\n<ul>\n<li><a title=\"MagpieRSS: RSS for PHP\" href=\"http:\/\/magpierss.sourceforge.net\/\" target=\"_blank\">MagpieRSS: RSS for PHP<\/a><\/li>\n<li><a title=\"Build a customizable RSS feed aggregator in PHP\" href=\"http:\/\/www.ibm.com\/developerworks\/library\/wa-aj-rssphp\/index.html?S_TACT=105AGX44&amp;S_CMP=EDU\" target=\"_blank\">Build a customizable RSS feed aggregator in PHP<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>RSS\u00a0\/\u00a0ATOM\u00a0\u7684\u683c\u5f0f\u8981\u4ea7\u751f\u90fd\u5f88\u7b80\u5355,\u00a0\u9ebb\u70e6\u7684\u662f\u65e5\u671f\u683c\u5f0f\u7684\u4ea7\u751f(RSS\u00a0=&amp;gt;\u00a0pubDat [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-245","post","type-post","status-publish","format-standard","hentry","category-php"],"_links":{"self":[{"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/posts\/245","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=245"}],"version-history":[{"count":1,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/posts\/245\/revisions"}],"predecessor-version":[{"id":433,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/posts\/245\/revisions\/433"}],"wp:attachment":[{"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=245"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=245"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}