{"id":28959,"date":"2024-11-25T14:14:47","date_gmt":"2024-11-25T06:14:47","guid":{"rendered":"https:\/\/fwq.ai\/blog\/28959\/"},"modified":"2024-11-25T14:14:47","modified_gmt":"2024-11-25T06:14:47","slug":"%e5%88%86%e4%ba%ab%e5%be%ae%e4%bf%a1%e5%bc%80%e5%8f%91%e8%87%aa%e5%ae%9a%e4%b9%89%e8%8f%9c%e5%8d%95%e7%9a%84%e5%a4%84%e7%90%86%e7%a4%ba%e4%be%8b%e4%bb%a3%e7%a0%81","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/28959\/","title":{"rendered":"\u5206\u4eab\u5fae\u4fe1\u5f00\u53d1\u81ea\u5b9a\u4e49\u83dc\u5355\u7684\u5904\u7406\u793a\u4f8b\u4ee3\u7801"},"content":{"rendered":"<p>\u5728\u5fae\u4fe15.0\u4ee5\u524d\uff0c\u662f\u4f5c\u4e3a\u4e00\u79cd\u5185\u6d4b\u8d44\u683c\u4f7f\u7528\u7684\uff0c\u53ea\u6709\u5c11\u6570\u516c\u4f17\u5e10\u53f7\u62e5\u6709\u83dc\u5355\uff0c\u56e0\u6b64\u51fa\u73b0\u5f88\u591a\u4f01\u4e1a\u4e3a\u4e86\u5f04\u5230\u83dc\u5355\u4e0d\u60dc\u91cd\u91d1\u6c42\u8d2d\u3002\u73b0\u5982\u4eca\uff0c\u4e00\u5927\u6279\u5e10\u53f7\u4ece\u8ba2\u9605\u53f7\u8f6c\u4e3a\u670d\u52a1\u53f7\uff0c\u5f88\u591a\u90fd\u662f\u5954\u7740\u81ea\u5b9a\u4e49\u83dc\u5355\u53bb\u7684\u3002\u4eca\u5929\u6211\u4eec\u5c31\u6765\u7b80\u5355\u7814\u7a76\u4e0b\u5fae\u4fe1\u81ea\u5b9a\u4e49\u83dc\u5355\u7684\u5904\u7406\u3002<\/p>\n<p><strong>\u81ea\u5b9a\u4e49\u83dc\u5355\u7684\u521b\u5efa<\/strong><\/p>\n<\/p>\n<pre>&lt;?php  \r\ndefine(\"APPID\", \"\u60a8\u7684appid\");\r\ndefine(\"APPSECRET\", \"\u60a8\u7684appsecret \");\r\n \r\n$token_access_url = \"https:\/\/api.weixin.qq.com\/cgi-bin\/token?grant_type=client_credential&amp;appid=\" . APPID . \"&amp;secret=\" . APPSECRET;\r\n$res = file_get_contents($token_access_url);  \/\/\u83b7\u53d6\u6587\u4ef6\u5185\u5bb9\u6216\u83b7\u53d6\u7f51\u7edc\u8bf7\u6c42\u7684\u5185\u5bb9\r\n\/\/echo $res;\r\n$result = json_decode($res, true);  \/\/\u63a5\u53d7\u4e00\u4e2a JSON \u683c\u5f0f\u7684\u5b57\u7b26\u4e32\u5e76\u4e14\u628a\u5b83\u8f6c\u6362\u4e3a PHP \u53d8\u91cf\r\n$access_token = $result[&#039;access_token&#039;];\r\n \r\ndefine(\"ACCESS_TOKEN\", $access_token);  \/\/\u5c06access_token\u5b9a\u4e49\u4e3a\u5e38\u91cf,\u4fbf\u4e8e\u4f7f\u7528.\r\n \r\n$make_menu_url = \"https:\/\/api.weixin.qq.com\/cgi-bin\/menu\/create?access_token=\" . ACCESS_TOKEN;\r\n \r\n$menuData = &#039; {\r\n   \"button\":[\r\n   {\r\n     \"type\":\"click\",\r\n     \"name\":\"\u4eca\u65e5\u6b4c\u66f2\",\r\n     \"key\":\"V1001_TODAY_MUSIC\"\r\n   },\r\n   {\r\n      \"name\":\"\u83dc\u5355\",\r\n      \"sub_button\":[\r\n      {\r\n        \"type\":\"view\",\r\n        \"name\":\"\u641c\u7d22\",\r\n        \"url\":\"http:\/\/www.soso.com\/\"\r\n      },\r\n      {\r\n        \"type\":\"view\",\r\n        \"name\":\"\u89c6\u9891\",\r\n        \"url\":\"http:\/\/v.qq.com\/\"\r\n      },\r\n      {\r\n        \"type\":\"click\",\r\n        \"name\":\"\u8d5e\u4e00\u4e0b\u6211\u4eec\",\r\n        \"key\":\"V1001_GOOD\"\r\n      }]\r\n    }]\r\n }&#039;;\r\n \r\n$ch = curl_init();\r\n \r\ncurl_setopt($ch, CURLOPT_URL, $make_menu_url);\r\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"POST\");\r\ncurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);\r\ncurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);\r\ncurl_setopt($ch, CURLOPT_USERAGENT, \"Mozilla\/5.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)\");\r\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);\r\ncurl_setopt($ch, CURLOPT_AUTOREFERER, 1);\r\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $menuData);\r\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\r\n \r\n$info = curl_exec($ch);\r\n \r\n\/\/\u5224\u8bfb\u6267\u884c\u8fc7\u7a0b\u4e2d\u662f\u5426\u6709\u9519\u8bef\uff0c\u6709\u5219\u53d1\u9001\u6570\u636e\u9519\u8bef\u62a5\u544a.\r\nif (curl_errno($ch)) {\r\n  echo &#039;Error&#039; . curl_error($ch); \/\/\u7528\u6237\u68c0\u67e5php\u8fd0\u884c\u73af\u5883\u4e2d\u7684curl\u6a21\u5757\u5f00\u542f\u60c5\u51b5.\r\n}\r\n \r\ncurl_close($ch);\r\nprint_r($info); \/\/\u67e5\u770bpost\u63d0\u4ea4\u5230\u5fae\u4fe1\u670d\u52a1\u5668\u540e\uff0c\u8fd4\u56de\u7684\u6570\u636e.<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u81ea\u5b9a\u4e49\u83dc\u5355\u7684\u83b7\u53d6<\/strong><\/p>\n<\/p>\n<pre>&lt;?php  \r\ndefine(\"APPID\", \"\u60a8\u7684appid\");\r\ndefine(\"APPSECRET\", \"\u60a8\u7684appsecret \");\r\n \r\n$token_access_url = \"https:\/\/api.weixin.qq.com\/cgi-bin\/token?grant_type=client_credential&amp;appid=\" . APPID . \"&amp;secret=\" . APPSECRET;\r\n$res = file_get_contents($token_access_url);  \/\/\u83b7\u53d6\u6587\u4ef6\u5185\u5bb9\u6216\u83b7\u53d6\u7f51\u7edc\u8bf7\u6c42\u7684\u5185\u5bb9\r\n$result = json_decode($res, true);  \/\/\u63a5\u53d7\u4e00\u4e2a JSON \u683c\u5f0f\u7684\u5b57\u7b26\u4e32\u5e76\u4e14\u628a\u5b83\u8f6c\u6362\u4e3a PHP \u53d8\u91cf\r\n$access_token = $result[&#039;access_token&#039;];\r\n \r\n$make_menu_url = \"https:\/\/api.weixin.qq.com\/cgi-bin\/menu\/get?access_token=\" . $access_token;\r\n \r\n$menu_json = file_get_contents($make_menu_url);\r\n \r\necho $menu_json;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u81ea\u5b9a\u4e49\u83dc\u5355\u7684<\/strong><\/p>\n<\/p>\n<pre>&lt;?php  \r\ndefine(\"APPID\", \"\u60a8\u7684appid\");\r\ndefine(\"APPSECRET\", \"\u60a8\u7684appsecret \");\r\n \r\n$token_access_url = \"https:\/\/api.weixin.qq.com\/cgi-bin\/token?grant_type=client_credential&amp;appid=\" . APPID . \"&amp;secret=\" . APPSECRET;\r\n$res = file_get_contents($token_access_url);  \/\/\u83b7\u53d6\u6587\u4ef6\u5185\u5bb9\u6216\u83b7\u53d6\u7f51\u7edc\u8bf7\u6c42\u7684\u5185\u5bb9\r\n$result = json_decode($res, true);  \/\/\u63a5\u53d7\u4e00\u4e2a JSON \u683c\u5f0f\u7684\u5b57\u7b26\u4e32\u5e76\u4e14\u628a\u5b83\u8f6c\u6362\u4e3a PHP \u53d8\u91cf\r\n$access_token = $result[&#039;access_token&#039;];\r\n \r\n$make_menu_url = \"https:\/\/api.weixin.qq.com\/cgi-bin\/menu\/delete?access_token=\" . $access_token;\r\n \r\n$menu_json = file_get_contents($make_menu_url);\r\n \r\necho $menu_json;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u6240\u8ff0\u5c31\u662f\u672c\u6587\u7684\u5168\u90e8\u5185\u5bb9\u4e86\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u505a\u5fae\u4fe1\u5f00\u53d1\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5206\u4eab\u5fae\u4fe1\u5f00\u53d1\u81ea\u5b9a\u4e49\u83dc\u5355\u7684\u5904\u7406\u793a\u4f8b\u4ee3\u7801\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>\u5728\u5fae\u4fe15.0\u4ee5\u524d\uff0c\u662f\u4f5c\u4e3a\u4e00\u79cd\u5185\u6d4b\u8d44\u683c\u4f7f\u7528\u7684\uff0c\u53ea\u6709\u5c11\u6570\u516c\u4f17\u5e10\u53f7\u62e5\u6709\u83dc\u5355\uff0c\u56e0\u6b64\u51fa\u73b0\u5f88\u591a\u4f01\u4e1a\u4e3a\u4e86\u5f04\u5230\u83dc\u5355\u4e0d\u60dc\u91cd\u91d1\u6c42\u8d2d\u3002\u73b0\u5982\u4eca\uff0c\u4e00\u5927\u6279\u5e10\u53f7\u4ece\u8ba2\u9605\u53f7\u8f6c\u4e3a\u670d\u52a1\u53f7\uff0c\u5f88\u591a\u90fd\u662f\u5954\u7740\u81ea\u5b9a\u4e49\u83dc\u5355\u53bb\u7684\u3002\u4eca\u5929\u6211\u4eec\u5c31\u6765\u7b80\u5355\u7814\u7a76\u4e0b\u5fae\u4fe1\u81ea\u5b9a\u4e49\u83dc\u5355\u7684\u5904\u7406\u3002 \u81ea\u5b9a\u4e49\u83dc\u5355\u7684\u521b\u5efa &lt;?php define(&#8220;APPID&#8221;, &#8220;\u60a8\u7684appid&#8221;); define(&#8220;APPSECRET&#8221;, &#8220;\u60a8\u7684appsecret &#8220;); $token_access_url = &#8220;https:\/\/api.weixin.qq.com\/cgi-bin\/token?grant_type=client_credential&amp;appid=&#8221; . APPID . &#8220;&amp;secret=&#8221; . APPSECRET; $res = file_get_contents($token_access_url); \/\/\u83b7\u53d6\u6587\u4ef6\u5185\u5bb9\u6216\u83b7\u53d6\u7f51\u7edc\u8bf7\u6c42\u7684\u5185\u5bb9 \/\/echo $res; $result = json_decode($res, true); \/\/\u63a5\u53d7\u4e00\u4e2a JSON \u683c\u5f0f\u7684\u5b57\u7b26\u4e32\u5e76\u4e14\u628a\u5b83\u8f6c\u6362\u4e3a PHP \u53d8\u91cf $access_token = $result[&#039;access_token&#039;]; define(&#8220;ACCESS_TOKEN&#8221;, $access_token); \/\/\u5c06access_token\u5b9a\u4e49\u4e3a\u5e38\u91cf,\u4fbf\u4e8e\u4f7f\u7528. $make_menu_url = &#8220;https:\/\/api.weixin.qq.com\/cgi-bin\/menu\/create?access_token=&#8221; . ACCESS_TOKEN; $menuData = &#039; { &#8220;button&#8221;:[ { &#8220;type&#8221;:&#8221;click&#8221;, &#8220;name&#8221;:&#8221;\u4eca\u65e5\u6b4c\u66f2&#8221;, &#8220;key&#8221;:&#8221;V1001_TODAY_MUSIC&#8221; }, { &#8220;name&#8221;:&#8221;\u83dc\u5355&#8221;, [&hellip;]<\/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-28959","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/28959","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=28959"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/28959\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=28959"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=28959"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=28959"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}