{"id":1337,"date":"2017-06-19T12:23:04","date_gmt":"2017-06-19T04:23:04","guid":{"rendered":"https:\/\/www.webteach.tw\/?p=1337"},"modified":"2017-06-19T12:23:04","modified_gmt":"2017-06-19T04:23:04","slug":"%e7%ac%ac%e4%b8%80%e5%a4%a9-%e6%9c%80%e5%be%8c%e4%b8%80%e5%a4%a9","status":"publish","type":"post","link":"https:\/\/www.webteach.tw\/?p=1337","title":{"rendered":"[ PHP ] &#8211; \u53d6\u5f97\u67d0\u65e5\u671f\u70ba\u7b2c\u5e7e\u9031\u53ca\u8a72\u9031\u7684\u7b2c\u4e00\u5929\u8ddf\u6700\u5f8c\u4e00\u5929"},"content":{"rendered":"<p>\t\t\t\t[php]<br \/>\n&lt;?php<br \/>\n\/\/\u53d6\u5f97\u67d0\u65e5\u671f\u70ba\u7b2c\u5e7e\u9031\u53ca\u8a72\u9031\u7684\u7b2c\u4e00\u5929\u8ddf\u6700\u5f8c\u4e00\u5929<br \/>\nfunction getweek_fday_lday($thisday){<br \/>\n\t\/\/\u53d6\u5f97thisday \u70ba\u79ae\u62dc\u5e7e 0-6<br \/>\n\t$weekday = date(&quot;w&quot;, strtotime($thisday));<br \/>\n\t\/\/\u8a72\u9031\u7684\u7b2c\u4e00\u5929<br \/>\n\t$week_fday = date(&quot;Y-m-d&quot;, strtotime(&quot;$thisday -&quot;.$weekday.&quot; days&quot;));<br \/>\n\t\/\/\u8a72\u9031\u7684\u6700\u5f8c\u4e00\u5929<br \/>\n\t$week_lday = date(&quot;Y-m-d&quot;, strtotime(&quot;$week_fday +6 days&quot;));<br \/>\n\t\/\/\u56de\u50b3 \u65e5\u671f,\u8a72\u65e5\u671f\u7576\u9031\u7684\u7b2c\u4e00\u5929,\u8a72\u65e5\u671f\u7576\u9031\u7684\u6700\u5f8c\u4e00\u5929<br \/>\n\treturn array(&#8216;this_day&#8217;=&gt;$thisday,&#8217;week_first_day&#8217;=&gt;$week_fday,&#8217;week_last_day&#8217;=&gt;$week_lday);<br \/>\n}<br \/>\nvar_dump(getweek_fday_lday(date(&quot;Y-m-d&quot;)));<br \/>\n?&gt;<br \/>\n[\/php]<br \/>\n\u7d50\u679c\u8f38\u51fa\uff1a<br \/>\narray(3) {<br \/>\n [&#8220;this_day&#8221;]=> string(10) &#8220;2017-06-19&#8221;<br \/>\n [&#8220;week_first_day&#8221;]=> string(10) &#8220;2017-06-18&#8221;<br \/>\n [&#8220;week_last_day&#8221;]=> string(10) &#8220;2017-06-24&#8221;<br \/>\n }\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[php] &lt;?php \/\/\u53d6\u5f97\u67d0\u65e5\u671f\u70ba\u7b2c\u5e7e&#8230;<\/p>\n","protected":false},"author":1,"featured_media":2201,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[45],"tags":[448,922,941,1047,1072],"class_list":["post-1337","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-date","tag-php","tag-922","tag-941","tag-1047","tag-1072","hvn-theme-has-thumbnail"],"_links":{"self":[{"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/posts\/1337","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1337"}],"version-history":[{"count":0,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/posts\/1337\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=\/wp\/v2\/media\/2201"}],"wp:attachment":[{"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1337"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1337"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webteach.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1337"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}