{"id":32611,"date":"2024-11-25T08:19:51","date_gmt":"2024-11-25T00:19:51","guid":{"rendered":"https:\/\/fwq.ai\/blog\/32611\/"},"modified":"2024-11-25T08:19:51","modified_gmt":"2024-11-25T00:19:51","slug":"%e5%b0%8f%e7%a8%8b%e5%ba%8f%e6%b6%88%e6%81%af%e6%8e%a8%e9%80%81%e9%85%8d%e7%bd%ae%e6%a1%88%e4%be%8b","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/32611\/","title":{"rendered":"\u5c0f\u7a0b\u5e8f\u6d88\u606f\u63a8\u9001\u914d\u7f6e\u6848\u4f8b"},"content":{"rendered":"<p>\u672c\u6587\u4ecb\u7ecd\u4e86\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u6d88\u606f\u63a8\u9001\u80fd\u529b\u7684\u914d\u7f6e\u65b9\u6cd5\uff0c\u5e0c\u671b\u5bf9\u5b66\u4e60\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u7684\u670b\u53cb\u6709\u5e2e\u52a9\uff01<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/040\/5e63052e5af0c939.jpg\" class=\"aligncenter\" title=\"\u5c0f\u7a0b\u5e8f\u6d88\u606f\u63a8\u9001\u914d\u7f6e\u6848\u4f8b\u63d2\u56fe\" alt=\"\u5c0f\u7a0b\u5e8f\u6d88\u606f\u63a8\u9001\u914d\u7f6e\u6848\u4f8b\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5c0f\u7a0b\u5e8f\u6d88\u606f\u63a8\u9001\u914d\u7f6e\u6848\u4f8b<\/strong><\/p>\n<p>\u4e3a\u4e30\u5bcc\u5c0f\u7a0b\u5e8f\u7684\u670d\u52a1\u80fd\u529b\uff0c\u63d0\u9ad8\u670d\u52a1\u8d28\u91cf\uff0c\u5fae\u4fe1\u4e3a\u5c0f\u7a0b\u5e8f\u63d0\u4f9b\u5ba2\u670d\u6d88\u606f\u80fd\u529b\uff0c\u4ee5\u4fbf\u5c0f\u7a0b\u5e8f\u7528\u6237\u53ef\u4ee5\u65b9\u4fbf\u5feb\u6377\u5730\u4e0e\u5c0f\u7a0b\u5e8f\u670d\u52a1\u63d0\u4f9b\u65b9\u8fdb\u884c\u6c9f\u901a\u3002\u542f\u7528\u5e76\u8bbe\u7f6e\u6d88\u606f\u63a8\u9001\u914d\u7f6e\u540e\uff0c\u7528\u6237\u53d1\u7ed9\u5c0f\u7a0b\u5e8f\u7684\u6d88\u606f\u4ee5\u53ca\u5f00\u53d1\u8005\u9700\u8981\u7684\u4e8b\u4ef6\u63a8\u9001\uff0c\u90fd\u5c06\u88ab\u5fae\u4fe1\u8f6c\u53d1\u81f3\u8be5\u670d\u52a1\u5668\u5730\u5740\u4e2d\uff0c\u4e0b\u9762\u6211\u5c31\u6765\u770b\u4e0b\u8fd9\u662f\u600e\u4e48\u914d\u7f6e\u7684\u3002\u8fd9\u662f\u6211\u81ea\u5df1\u914d\u7f6e\u7684\u6848\u4f8b\u6548\u679c\u56fe\u3002<\/p>\n<p>\u63a8\u8350\u5b66\u4e60\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/image\/266\/594\/808\/1583547670262832.png\" class=\"aligncenter\" title=\"\u5c0f\u7a0b\u5e8f\u6d88\u606f\u63a8\u9001\u914d\u7f6e\u6848\u4f8b\u63d2\u56fe1\" alt=\"\u5c0f\u7a0b\u5e8f\u6d88\u606f\u63a8\u9001\u914d\u7f6e\u6848\u4f8b\u63d2\u56fe1\" \/><\/p>\n<p>\u6211\u5728\u81ea\u5df1\u7684\u670d\u52a1\u5668\u6839\u76ee\u5f55\u5b9a\u4e49api.php\u6587\u4ef6\uff0cURL\u586b\u5199\u7684\u5730\u5740\u4e3ahttp:\/\/www.100txy.com\/api.php\uff0c\u6587\u4ef6api.php\u5177\u4f53\u7684\u4ee3\u7801\u5982\u4e0b<\/p>\n<pre>&lt;?php define(\"TOKEN\",\"100txy\");\/\/ \u540e\u53f0\u586b\u5199\u7684token\n$wechatObj = new wechatAPI();\n$wechatObj-&gt;isValid();\nclass&nbsp;wechatAPI\n{\n&nbsp;&nbsp;public&nbsp;function&nbsp;isValid()\/\/\u9a8c\u8bc1\u5fae\u4fe1\u63a5\u53e3\uff0c\u5982\u679c\u786e\u8ba4\u662f\u5fae\u4fe1\u5c31\u8fd4\u56de\u5b83\u4f20\u6765\u7684echostr\u53c2\u6570\n&nbsp;&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$echoStr&nbsp;=&nbsp;$_GET[\"echostr\"];\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($this-&amp;gt;checkSignature())&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;$echoStr;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;}\n&nbsp;&nbsp;private&nbsp;function&nbsp;checkSignature(){&nbsp;\/\/\u5b98\u65b9\u7684\u9a8c\u8bc1\u51fd\u6570\n&nbsp;&nbsp;&nbsp;$signature&nbsp;=&nbsp;$_GET[\"signature\"];\n&nbsp;&nbsp;&nbsp;$timestamp&nbsp;=&nbsp;$_GET[\"timestamp\"];\n&nbsp;&nbsp;&nbsp;$nonce&nbsp;=&nbsp;$_GET[\"nonce\"];\n&nbsp;&nbsp;&nbsp;$token&nbsp;=&nbsp;TOKEN;\n&nbsp;&nbsp;&nbsp;$tmpArr&nbsp;=&nbsp;array($token,&nbsp;$timestamp,&nbsp;$nonce);\n&nbsp;&nbsp;&nbsp;sort($tmpArr,&nbsp;SORT_STRING);\n&nbsp;&nbsp;&nbsp;$tmpStr&nbsp;=&nbsp;implode(&nbsp;$tmpArr&nbsp;);\n&nbsp;&nbsp;&nbsp;$tmpStr&nbsp;=&nbsp;sha1(&nbsp;$tmpStr&nbsp;);\n&nbsp;&nbsp;&nbsp;if(&nbsp;$tmpStr&nbsp;==&nbsp;$signature&nbsp;){\n&nbsp;&nbsp;&nbsp;return&nbsp;true;\n&nbsp;&nbsp;&nbsp;}else{\n&nbsp;&nbsp;&nbsp;return&nbsp;false;\n&nbsp;&nbsp;&nbsp;}\n&nbsp;&nbsp;}\n};<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd9\u6837\u914d\u7f6e\u540e\u63d0\u4ea4\u5c31\u80fd\u542f\u7528\u6210\u529f\uff01<\/p>\n<p>\u66f4\u591a\u76f8\u5173\u6559\u7a0b\uff0c\u8bf7\u5173\u6ce8\uff01<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5c0f\u7a0b\u5e8f\u6d88\u606f\u63a8\u9001\u914d\u7f6e\u6848\u4f8b\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u4ecb\u7ecd\u4e86\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u6d88\u606f\u63a8\u9001\u80fd\u529b\u7684\u914d\u7f6e\u65b9\u6cd5\uff0c\u5e0c\u671b\u5bf9\u5b66\u4e60\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u7684\u670b\u53cb\u6709\u5e2e\u52a9\uff01 \u5c0f\u7a0b\u5e8f\u6d88\u606f\u63a8\u9001\u914d\u7f6e\u6848\u4f8b \u4e3a\u4e30\u5bcc\u5c0f\u7a0b\u5e8f\u7684\u670d\u52a1\u80fd\u529b\uff0c\u63d0\u9ad8\u670d\u52a1\u8d28\u91cf\uff0c\u5fae\u4fe1\u4e3a\u5c0f\u7a0b\u5e8f\u63d0\u4f9b\u5ba2\u670d\u6d88\u606f\u80fd\u529b\uff0c\u4ee5\u4fbf\u5c0f\u7a0b\u5e8f\u7528\u6237\u53ef\u4ee5\u65b9\u4fbf\u5feb\u6377\u5730\u4e0e\u5c0f\u7a0b\u5e8f\u670d\u52a1\u63d0\u4f9b\u65b9\u8fdb\u884c\u6c9f\u901a\u3002\u542f\u7528\u5e76\u8bbe\u7f6e\u6d88\u606f\u63a8\u9001\u914d\u7f6e\u540e\uff0c\u7528\u6237\u53d1\u7ed9\u5c0f\u7a0b\u5e8f\u7684\u6d88\u606f\u4ee5\u53ca\u5f00\u53d1\u8005\u9700\u8981\u7684\u4e8b\u4ef6\u63a8\u9001\uff0c\u90fd\u5c06\u88ab\u5fae\u4fe1\u8f6c\u53d1\u81f3\u8be5\u670d\u52a1\u5668\u5730\u5740\u4e2d\uff0c\u4e0b\u9762\u6211\u5c31\u6765\u770b\u4e0b\u8fd9\u662f\u600e\u4e48\u914d\u7f6e\u7684\u3002\u8fd9\u662f\u6211\u81ea\u5df1\u914d\u7f6e\u7684\u6848\u4f8b\u6548\u679c\u56fe\u3002 \u63a8\u8350\u5b66\u4e60\uff1a \u6211\u5728\u81ea\u5df1\u7684\u670d\u52a1\u5668\u6839\u76ee\u5f55\u5b9a\u4e49api.php\u6587\u4ef6\uff0cURL\u586b\u5199\u7684\u5730\u5740\u4e3ahttp:\/\/www.100txy.com\/api.php\uff0c\u6587\u4ef6api.php\u5177\u4f53\u7684\u4ee3\u7801\u5982\u4e0b &lt;?php define(&#8220;TOKEN&#8221;,&#8221;100txy&#8221;);\/\/ \u540e\u53f0\u586b\u5199\u7684token $wechatObj = new wechatAPI(); $wechatObj-&gt;isValid(); class&nbsp;wechatAPI { &nbsp;&nbsp;public&nbsp;function&nbsp;isValid()\/\/\u9a8c\u8bc1\u5fae\u4fe1\u63a5\u53e3\uff0c\u5982\u679c\u786e\u8ba4\u662f\u5fae\u4fe1\u5c31\u8fd4\u56de\u5b83\u4f20\u6765\u7684echostr\u53c2\u6570 &nbsp;&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$echoStr&nbsp;=&nbsp;$_GET[&#8220;echostr&#8221;]; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;($this-&amp;gt;checkSignature())&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;$echoStr; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;} &nbsp;&nbsp;private&nbsp;function&nbsp;checkSignature(){&nbsp;\/\/\u5b98\u65b9\u7684\u9a8c\u8bc1\u51fd\u6570 &nbsp;&nbsp;&nbsp;$signature&nbsp;=&nbsp;$_GET[&#8220;signature&#8221;]; &nbsp;&nbsp;&nbsp;$timestamp&nbsp;=&nbsp;$_GET[&#8220;timestamp&#8221;]; &nbsp;&nbsp;&nbsp;$nonce&nbsp;=&nbsp;$_GET[&#8220;nonce&#8221;]; &nbsp;&nbsp;&nbsp;$token&nbsp;=&nbsp;TOKEN; &nbsp;&nbsp;&nbsp;$tmpArr&nbsp;=&nbsp;array($token,&nbsp;$timestamp,&nbsp;$nonce); &nbsp;&nbsp;&nbsp;sort($tmpArr,&nbsp;SORT_STRING); &nbsp;&nbsp;&nbsp;$tmpStr&nbsp;=&nbsp;implode(&nbsp;$tmpArr&nbsp;); &nbsp;&nbsp;&nbsp;$tmpStr&nbsp;=&nbsp;sha1(&nbsp;$tmpStr&nbsp;); &nbsp;&nbsp;&nbsp;if(&nbsp;$tmpStr&nbsp;==&nbsp;$signature&nbsp;){ &nbsp;&nbsp;&nbsp;return&nbsp;true; &nbsp;&nbsp;&nbsp;}else{ &nbsp;&nbsp;&nbsp;return&nbsp;false; &nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;} }; \u767b\u5f55\u540e\u590d\u5236 \u8fd9\u6837\u914d\u7f6e\u540e\u63d0\u4ea4\u5c31\u80fd\u542f\u7528\u6210\u529f\uff01 \u66f4\u591a\u76f8\u5173\u6559\u7a0b\uff0c\u8bf7\u5173\u6ce8\uff01 \u4ee5\u4e0a\u5c31\u662f\u5c0f\u7a0b\u5e8f\u6d88\u606f\u63a8\u9001\u914d\u7f6e\u6848\u4f8b\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-32611","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/32611","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=32611"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/32611\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=32611"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=32611"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=32611"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}