{"id":31149,"date":"2020-02-12T10:45:09","date_gmt":"2020-02-12T02:45:09","guid":{"rendered":"http:\/\/4563.org\/?p=31149"},"modified":"2020-02-12T10:45:09","modified_gmt":"2020-02-12T02:45:09","slug":"php%e5%a4%a7%e4%bd%ac%e4%bb%ac%e6%9d%a5%e7%9c%8b%e4%b8%8b%e8%bf%99%e5%87%a0%e5%8f%a5%e4%bb%a3%e7%a0%81%e6%9c%89%e6%97%a0%e5%8f%af%e8%83%bd%e6%98%af-%e9%a9%ac","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=31149","title":{"rendered":"PHP\u5927\u4f6c\u4eec\u6765\u770b\u4e0b\u8fd9\u51e0\u53e5\u4ee3\u7801\u6709\u65e0\u53ef\u80fd\u662f \u9a6c"},"content":{"rendered":"\n<p>  \t\t\t\t\t<strong>hdwz<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-12-18 12:03:00\t<\/p>\n<h3>PHP\u5927\u4f6c\u4eec\u6765\u770b\u4e0b\u8fd9\u51e0\u53e5\u4ee3\u7801\u6709\u65e0\u53ef\u80fd\u662f \u9a6c<\/h3>\n<p>  \t\t \u672c\u5e16\u6700\u540e\u7531 hdwz \u4e8e 2019-12-18 12:57 \u7f16\u8f91 <\/p>\n<p> if (is_user_logged_in()) {<br \/>  &nbsp; &nbsp; $f = get_current_user_id();<br \/>  &nbsp; &nbsp; $d = get_user_meta($f, &#8216;like-posts&#8217;, true);<br \/>  &nbsp; &nbsp; if ($d) {<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;$d = unserialize($d);<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $e = in_array($b, $d);<br \/>  &nbsp; &nbsp; }<br \/>  }<\/p>\n<p>  function hui_is_my_like($pid=&#8221;){<br \/>  &nbsp; &nbsp; if( !is_user_logged_in() ) return false;<br \/>  &nbsp; &nbsp; $pid = $pid ? $pid : get_the_ID();<br \/>  &nbsp; &nbsp; $likes = get_user_meta( get_current_user_id(), &#8216;like-posts&#8217;, true );<br \/>  &nbsp; &nbsp; $likes = $likes ? unserialize($likes) : array();<br \/>  &nbsp; &nbsp; return in_array($pid, $likes) ? true : false;<br \/>  }<\/p>\n<p>  function tb_xzh_post_to_baidu() {<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; if( _hui(&#8216;xzh_on&#8217;) &amp;&amp; _hui(&#8216;xzh_appid&#8217;) &amp;&amp; _hui(&#8216;xzh_post_on&#8217;) &amp;&amp; _hui(&#8216;xzh_post_token&#8217;) ){<br \/>  &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;global $post;<br \/>  &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;$plink = get_permalink($post-&gt;ID);<\/p>\n<p>  &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;if( !$plink || get_post_meta($post-&gt;ID, &#8216;xzh_tui_back&#8217;, true) ){<br \/>  &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; return false;<br \/>  &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;}<\/p>\n<p>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $isoriginal = get_post_meta($post-&gt;ID, &#8216;is_original&#8217;, true);<br \/>  &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;$urls = array();<br \/>  &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;$urls[] = $plink;<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $api = &#8216;http:\/\/data.zz.baidu.com\/urls?appid=&#8217;. _hui(&#8216;xzh_appid&#8217;) .&#8217;&amp;token=&#8217;. _hui(&#8216;xzh_post_token&#8217;) .&#8217;&amp;type=realtime&#8217;;<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if( $isoriginal ){<br \/>  &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; $api .= &#8216;,original&#8217;;<br \/>  &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;}<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $ch = curl_init();<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $options =array(<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;CURLOPT_URL =&gt; $api,<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;CURLOPT_POST =&gt; true,<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;CURLOPT_RETURNTRANSFER =&gt; true,<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;CURLOPT_POSTFIELDS =&gt; implode(&quot;n&quot;, $urls),<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;CURLOPT_HTTPHEADER =&gt; array(&#8216;Content-Type: text\/plain&#8217;),<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; curl_setopt_array($ch, $options);<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $result = curl_exec($ch);<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $result = json_decode($result);<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $result_text = &#8216;\u6210\u529f&#8217;;<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if( $result-&gt;error ){<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $result_text = &#8216;\u5931\u8d25 &#8216;.$result-&gt;message;<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; update_post_meta($post-&gt;ID, &#8216;xzh_tui_back&#8217;, $result_text);<br \/>  &nbsp; &nbsp; &nbsp; &nbsp; <br \/>  &nbsp; &nbsp; &nbsp; &nbsp; }<br \/>  }\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u6715\u7684\u5927\u6e05\u5b8c\u4e86\uff1f<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-12-18 12:04:32\t<\/p>\n<h3><\/h3>\n<p>  \t\t\u5185\u5bb9\u592a\u5c11\uff0c\u770b\u4e0d\u51fa\u6765\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u9038\u7b19<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-12-18 12:27:33\t<\/p>\n<h3><\/h3>\n<p>  \t\t\u8fd9\u51e0\u53e5\u4e0d\u662f\u3002curl_init\u8ddfexec\u4e2d\u95f4\u7684\u53e5\u5b50\u5462\uff1f\u4ec0\u4e48\u4e5f\u6ca1\u5e72\u3002\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>.host.<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-12-18 12:49:16\t<\/p>\n<h3><\/h3>\n<p>  \t\t\u5927\u4f6c\u5e16\u7684\u5185\u5bb9\u4e2d\uff0c\u53d8\u91cf\u90fd\u662f\u6765\u65e0\u8e2a\u53bb\u65e0\u5f71\u3002<br \/>  \u8fa8\u4e0d\u51fa\u662f\u4e0d\u662f\u9a6c\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>Xuzi<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-12-18 13:56:12\t<\/p>\n<h3><\/h3>\n<p>  \t\t\u83b7\u53d6\u7528\u6237\u4fe1\u606f\u548c\u767e\u5ea6\u4e3b\u52a8\u63a8\u9001\uff0c\u5355\u8fd9\u4e9b\u770b\u4e0d\u51fa\u6709\u9a6c\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>HaoLan<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-12-18 13:58:22\t<\/p>\n<h3><\/h3>\n<p>  \t\t\u8fd9\u600e\u4e48\u5c31\u662f\u9a6c\u4e86\u3002\u3002\u7591\u5fc3\u592a\u91cd\u4e86\u5427\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>royaso<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-12-18 14:10:50\t<\/p>\n<h3><\/h3>\n<p>  \t\t\u8fd9\u5c31\u662f\u4e2a\u767e\u5ea6\u6536\u5f55\u63a8\u9001&#8230;.\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u534a\u4e16\u70df\u5c18<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-12-18 14:20:26\t<\/p>\n<h3><\/h3>\n<p>  \t\t\u4e0d\u662f, \u4e0b\u4e00\u4e2ayc022t\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>playbear<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019-12-18 14:21:21\t<\/p>\n<h3><\/h3>\n<p>  \t\t\u718a\u638c\u53f7\u4e3b\u52a8\u63a8\u9001\t\t\t  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>hdwz \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2019&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/31149"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=31149"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/31149\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=31149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=31149"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=31149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}