{"id":29237,"date":"2024-11-25T14:05:32","date_gmt":"2024-11-25T06:05:32","guid":{"rendered":"https:\/\/fwq.ai\/blog\/29237\/"},"modified":"2024-11-25T14:05:32","modified_gmt":"2024-11-25T06:05:32","slug":"php%e5%be%ae%e4%bf%a1%e5%85%ac%e4%bc%97%e5%8f%b7%e5%bc%80%e5%8f%91%e5%89%8d%e7%9a%84%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/29237\/","title":{"rendered":"php\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1\u524d\u7684\u95ee\u9898"},"content":{"rendered":"<p style=\"text-align: left\">\u8fd9\u7bc7\u6587\u7ae0\u4e3b\u8981\u4e3a\u5927\u5bb6\u8be6\u7ec6\u4ecb\u7ecd\u4e86php\u5fae\u4fe1\u516c\u4f17\u8d26\u53f7\u5f00\u53d1\u4e4b\u524d\u4e94\u4e2a\u5751,\u5177\u6709\u4e00\u5b9a\u7684\u53c2\u8003\u4ef7\u503c\uff0c\u611f\u5174\u8da3\u7684\u5c0f\u4f19\u4f34\u4eec\u53ef\u4ee5\u53c2\u8003\u4e00\u4e0b<\/p>\n<p style=\"text-align: left\">\u5fae\u4fe1\u516c\u4f17\u8d26\u53f7\u5f00\u53d1\u6587\u6863\uff0c\u5b98\u65b9\u7248\uff08https:\/\/mp.weixin.qq.com\/wiki\uff09<\/p>\n<p style=\"text-align: left\">\u9996\u5148\uff0c\u4f60\u5f97\u6709\u4e00\u4e2a\u516c\u4f17\u5e73\u53f0\u8d26\u53f7\uff0c\u597d\u4e86\uff0c\u5f00\u59cb\u8ba1\u5751\u3002&nbsp;<\/p>\n<p style=\"text-align: left\"><strong>\u7b2c\u4e00\u5751\uff0c<\/strong>\u4e0d\u8981\u4ee5\u4e3a\u4e0d\u662f\u4f01\u4e1a\u53f7\u5c31\u4e0d\u80fd\u5f00\u53d1\u4e86\uff0c\u53ef\u4ee5\u7533\u8bf7\u6d4b\u8bd5\u53f7\u7684\uff0c\u6bd4\u6240\u8c13\u7684\u8ba2\u9605\u53f7\u63a5\u53e3\u591a\u591a\u4e86\u3002<\/p>\n<p style=\"text-align: left\">&nbsp;<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/013\/4e0fc896b484b277c6188effe3218599-0.jpg\" style=\"max-width:90%\" class=\"aligncenter\" title=\"php\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1\u524d\u7684\u95ee\u9898\u63d2\u56fe\" alt=\"php\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1\u524d\u7684\u95ee\u9898\u63d2\u56fe\" \/><\/p>\n<p>\u8fdb\u5165\u540e\u53f0\u7ba1\u7406\u4e4b\u540e\uff0c\u70b9\u51fb\u5f00\u53d1\u8005\u5de5\u5177\uff0c\u53ef\u4ee5\u770b\u5230\u516c\u4f17\u5e73\u53f0\u6d4b\u8bd5\u8d26\u53f7\uff0c\u76f4\u63a5\u8fdb\u5165\u5373\u53ef\u3002\u5f00\u59cb\u586b\u5199\u81ea\u5df1\u7684\u914d\u7f6e\u3002&nbsp;<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/013\/4e0fc896b484b277c6188effe3218599-1.jpg\" style=\"max-width:90%\" class=\"aligncenter\" title=\"php\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1\u524d\u7684\u95ee\u9898\u63d2\u56fe1\" alt=\"php\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1\u524d\u7684\u95ee\u9898\u63d2\u56fe1\" \/><\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/013\/9bd1640a0a6aac99e332d0449bed6cd0-2.jpg\" style=\"max-width:90%\" class=\"aligncenter\" title=\"php\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1\u524d\u7684\u95ee\u9898\u63d2\u56fe2\" alt=\"php\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1\u524d\u7684\u95ee\u9898\u63d2\u56fe2\" \/><\/p>\n<p>\u6ce8\u610f\u6d82\u9e26\u90e8\u5206\uff0c\u8fd9\u90e8\u5206\u662f\u7a0b\u5e8f\u4e2d\u5fc5\u987b\u8981\u914d\u7f6e\u7684\u4e1c\u4e1c\uff0c\u5982\u679c\u6ca1\u6709\u914d\u7f6e\u7684\u8bdd\uff0c\u8fd9\u662f\u4e00\u5b9a\u4e0d\u6210\u529f\u7684\u3002&nbsp;<\/p>\n<p><strong>\u7b2c\u4e8c\u5751<\/strong>\uff0c\u5f53\u7136\uff0c\u4f60\u8fd9\u4e48\u914d\u7f6e\u4e5f\u4e00\u5b9a\u662f\u4e0d\u6210\u529f\u7684\uff0c\u4e0d\u8981\u95ee\u6211\u4e3a\u4ec0\u4e48\u3002\u6ca1\u56fe\u8bf4\u4e2a\u51e0\u628a\u3002\u3002\u3002&nbsp;<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/013\/9bd1640a0a6aac99e332d0449bed6cd0-3.jpg\" style=\"max-width:90%\" class=\"aligncenter\" title=\"php\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1\u524d\u7684\u95ee\u9898\u63d2\u56fe3\" alt=\"php\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1\u524d\u7684\u95ee\u9898\u63d2\u56fe3\" \/><\/p>\n<p>\u8bf7\u4e0d\u8981\u8ba4\u4e3a\u4f01\u9e45\u5e1d\u95f9\u7740\u73a9\uff0c\u8fd9\u662f\u771f\u7684\uff0c\u5fc5\u987b\u662f80\u7aef\u53e3\uff0c\u5176\u5b9e\u4e5f\u5c31\u53d1\u5e03\u4e00\u4e2a\u57df\u540d\u7684\u7f51\u7ad9\u5373\u53ef\u3002\u56e0\u4e3a\u57df\u540d\u7684\u7f51\u7ad9\u90fd\u662f80\u7aef\u53e3\u51fa\u6765\u7684\uff0c\u7ee7\u7eed\u8bf4\u6b63\u9898\u3002&nbsp;<\/p>\n<p>\u4f01\u9e45\u5e1d\u544a\u8bc9\u6211\u4eec\uff0c\u8981\u7528\u5fae\u4fe1\u8d26\u53f7\uff0c\u5fc5\u987b\u6709\u4e00\u53f0\u670d\u52a1\u5668\uff0c\u7136\u540e\u914d\u7f6e\u6211\u4eec\u53d1\u5e03\u7684\u7f51\u7ad9\u5c31\u884c\u4e86\uff0c\u8bf7\u6ce8\u610f\uff0ctoken\u662f\u81ea\u5df1\u8bbe\u5b9a\u7684\uff0c\u8fd9\u4e2a\u4e0d\u662f\u81ea\u52a8\u751f\u6210\u7684\uff0c\u81ea\u5df1\u8bbe\u5b9a\u3002\u3002URL\u5c31\u662f\u6211\u4eec\u53d1\u5e03\u7684\u7f51\u7ad9\u540d\u79f0&nbsp;<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p><strong>\u7b2c\u4e09\u5751\uff0c<\/strong>\u7f51\u7ad9\u4e0d\u53d1\u5e03\uff0c\u63a5\u53e3\u914d\u7f6e\u4fe1\u606f\u662f\u6c38\u8fdc\u914d\u7f6e\u4e0d\u8fc7\u53bb\u7684\uff0c\u8bb0\u4f4f\uff0c\u662f\u6c38\u8fdc\u3002&nbsp;<\/p>\n<p>JS\u63a5\u53e3\u5b89\u5168\u57df\u540d\u7684\u76ee\u7684\u662f\u4e3a\u4e86\u4e0b\u8f7d\u56fe\u7247\uff0c\u8c03\u7528\u5fae\u4fe1\u56fe\u7247\u63a5\u53e3\u7b49\u7b49\uff0c\u6bd4\u5982\u5f53\u4f60\u9700\u8981\u8c03\u7528\u6444\u50cf\u5934\u7684\u65f6\u5019\uff0c\u6216\u8005\u8bf4\u8bf4\u9700\u8981\u4e0a\u4f20\u7167\u7247\u7684\u65f6\u5019\uff0c\u8fd9\u65f6\u5019\u5c31\u9700\u8981JS\u5b89\u5168\u63a5\u53e3\u4e86\uff0c\u5173\u4e8e\u5177\u4f53\u7684\u5185\u5bb9\u6682\u4e0d\u505a\u8be6\u7ec6\u63cf\u8ff0\u3002&nbsp;<\/p>\n<p>\u5728\u5fae\u4fe1\u516c\u4f17\u8d26\u53f7\u6d4b\u8bd5\u53f7\u7684\u7248\u672c\u540e\u53f0\u4e2d\uff0c\u6709\u4e00\u4e2a\u4f53\u9a8c\u63a5\u53e3\u6743\u9650\u8868\u91cc\u9762\u7684\u8fd9\u4e00\u9879\u4e5f\u662f\u5fc5\u987b\u914d\u7f6e\u7684\u3002\u4e5f\u4e0d\u7b97\u662f\u5fc5\u987b\u914d\u7f6e\uff0c\u800c\u662f\u8fd9\u4e2a\u63a5\u53e3\u53ef\u4ee5\u83b7\u53d6\u5230\u5fae\u4fe1\u7528\u6237\u7684\u90e8\u5206\u4fe1\u606f\u3002\u503c\u5f97\u63d0\u9192\u7684\u662f\u6bcf\u4e2a\u516c\u4f17\u8d26\u53f7\u5bf9\u5e94\u7684\u6bcf\u4e2aID\u662f\u552f\u4e00\u7684\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u5373\u4fbf\u7f51\u7ad9\u5185\u7f51\u4e0d\u53d8\uff0c\u5982\u679c\u6362\u4e86\u516c\u4f17\u53f7\uff0c\u90a3\u4e48\uff0c\u8fd9\u65f6\u5019\u7684\u5fae\u4fe1\u516c\u4f17\u53f7\u7684\u6570\u636e\u662f\u4e0d\u80fd\u5171\u901a\u7684\uff0c<span style=\"color: #800000\">\u53ea\u662f\u76f8\u5bf9\u516c\u5171\u53f7\u552f\u4e00\u3002<\/span>&nbsp;<\/p>\n<p style=\"text-align: center\"><strong><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/013\/c3736d956dae99541e89a1f2a423147c-4.jpg\" style=\"max-width:90%\" class=\"aligncenter\" title=\"php\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1\u524d\u7684\u95ee\u9898\u63d2\u56fe4\" alt=\"php\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1\u524d\u7684\u95ee\u9898\u63d2\u56fe4\" \/><\/strong><\/p>\n<p><strong>\u7b2c\u56db\u5751\uff0c<\/strong>\u7533\u8bf7\u5fae\u4fe1\u7f51\u9875\u6388\u6743\u7684\u65f6\u5019\uff0c\u8fd9\u91cc\u7684\u7f51\u9875\u6388\u6743\u7528\u6237\u57fa\u672c\u4fe1\u606f\uff0c\u8fd9\u4e2a\u672c\u8eab\u6ca1\u95ee\u9898\uff0c\u4f46\u662f\u6ca1\u6709\u63d0\u793a\u5c31\u6709\u95ee\u9898\u4e86\u3002&nbsp;<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/013\/c3736d956dae99541e89a1f2a423147c-5.jpg\" style=\"max-width:90%\" class=\"aligncenter\" title=\"php\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1\u524d\u7684\u95ee\u9898\u63d2\u56fe5\" alt=\"php\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1\u524d\u7684\u95ee\u9898\u63d2\u56fe5\" \/><\/p>\n<p>\u8fd9\u91cc\u7684\u7f51\u5740\uff0c\u8bf7\u6ce8\u610f\uff0c<span style=\"color: #800000\"><strong>\u4e00\u5b9a\u662f\u4e0d\u542bwww\u7684\uff0c\u800c\u4e14\u540e\u9762\u6ca1\u6709\u53cd\u659c\u6760<\/strong><\/span>\uff0c\u4e5f\u5c31\u662f\u8bf4\u8fd9\u91cc\u7684\u7f51\u5740\u7684\u56de\u8c03\u683c\u5f0f\u662f&nbsp; abc.com OK\uff0c\u8bf7\u8bb0\u4f4f\u8fd9\u4e2a\u683c\u5f0f\uff0c\u5fc5\u987b\u8fd9\u4e48\u5e72\u3002\u597d\u4e86\uff0c\u670d\u52a1\u5668\u6682\u4e14\u8fd9\u6837\uff0c\u6682\u5f00\u59cb\u7528\u4ee3\u7801\u8bf4\u8bdd\u3002&nbsp;<\/p>\n<p>\u9996\u5148\u4ece\u670d\u52a1\u5668\u9a8c\u8bc1\u8bf4\u8d77\u3002\u8fd9\u4e2a\u5728\u5b98\u7f51\u662f\u6709\u4f8b\u5b50\u7684\uff0c\u4e0d\u8fc7\u662fPHP\u7684\uff0c\u5176\u5b9e\u8bf4\u767d\u4e86\u9996\u5148\u5c31\u662f\u9a8c\u8bc1\u4e00\u4e2a\u968f\u673a\u6570\uff0c\u7136\u540e\u5728POST\u7684\u60c5\u51b5\u4e0b\uff0c\u68c0\u6d4b\u8fd4\u56de\u503c\u5373\u53ef\u3002\u76f4\u63a5\u4e0a\u4ee3\u7801&nbsp;<\/p>\n<p><\/p>\n<pre>&nbsp;public&nbsp;ActionResult&nbsp;Index()\r\n&nbsp;{\r\n&nbsp;if&nbsp;(Request.HttpMethod.ToLower()&nbsp;==&nbsp;\"post\")\r\n&nbsp;{\r\n&nbsp;if&nbsp;(CheckSignature())\/\/\u9a8c\u8bc1\u670d\u52a1\u5668\u662f\u5426\u901a\u8fc7\r\n&nbsp;{\r\n&nbsp;GetMenuList();\/\/\u52a0\u8f7d\u83dc\u5355\r\n&nbsp;}\r\n&nbsp;else\r\n&nbsp;{\r\n&nbsp;Response.Write(\"&lt;h1&gt;Oh&lt;\/h1&gt;&lt;h2&gt;\u6211\u4eec\u76f8\u9047\u5728\u706b\u661f\u5427\uff01\uff01\uff01&lt;\/h2&gt;\");\r\n&nbsp;Response.End();\r\n&nbsp;}\r\n&nbsp;}\r\n&nbsp;else\r\n&nbsp;{\r\n&nbsp;CheckWechat();\r\n&nbsp;}\r\n&nbsp;return&nbsp;View();\r\n&nbsp;}\r\n\r\n&nbsp;\r\n\r\n&nbsp;\/\/\/&nbsp;&lt;summary&gt;\r\n&nbsp;\/\/\/&nbsp;\u8fd4\u56de\u968f\u673a\u6570\u8868\u793a\u9a8c\u8bc1\u6210\u529f\r\n&nbsp;\/\/\/&nbsp;&lt;\/summary&gt;\r\n&nbsp;private&nbsp;void&nbsp;CheckWechat()\r\n&nbsp;{\r\n&nbsp;if&nbsp;(string.IsNullOrEmpty(Request.QueryString[\"echoStr\"]))\r\n&nbsp;{\r\n&nbsp;Response.Write(\"\u6d88\u606f\u5e76\u975e\u6765\u81ea\u5fae\u4fe1\");\r\n&nbsp;Response.End();\r\n&nbsp;}\r\n&nbsp;string&nbsp;echoStr&nbsp;=&nbsp;Request.QueryString[\"echoStr\"];\r\n&nbsp;if&nbsp;(CheckSignature())\r\n&nbsp;{\r\n&nbsp;Response.Write(echoStr);\r\n&nbsp;Response.End();\r\n&nbsp;}\r\n&nbsp;}\r\n\r\n\/\/\/&nbsp;&lt;summary&gt;\r\n&nbsp;\/\/\/&nbsp;\u9a8c\u8bc1\u5fae\u4fe1\u7b7e\u540d\r\n&nbsp;\/\/\/&nbsp;&lt;\/summary&gt;\r\n&nbsp;\/\/\/&nbsp;&lt;returns&gt;&lt;\/returns&gt;\r\n&nbsp;\/\/\/&nbsp;\u5c06token\u3001timestamp\u3001nonce\u4e09\u4e2a\u53c2\u6570\u8fdb\u884c\u5b57\u5178\u5e8f\u6392\u5e8f\r\n&nbsp;\/\/\/&nbsp;\u5c06\u4e09\u4e2a\u53c2\u6570\u5b57\u7b26\u4e32\u62fc\u63a5\u6210\u4e00\u4e2a\u5b57\u7b26\u4e32\u8fdb\u884csha1\u52a0\u5bc6\r\n&nbsp;\/\/\/&nbsp;\u5f00\u53d1\u8005\u83b7\u5f97\u52a0\u5bc6\u540e\u7684\u5b57\u7b26\u4e32\u53ef\u4e0esignature\u5bf9\u6bd4\uff0c\u6807\u8bc6\u8be5\u8bf7\u6c42\u6765\u6e90\u4e8e\u5fae\u4fe1\u3002\r\n&nbsp;private&nbsp;bool&nbsp;CheckSignature()\r\n\r\n&nbsp;{\r\n&nbsp;string&nbsp;signature&nbsp;=&nbsp;Convert.ToString(Request[\"signature\"]);\r\n&nbsp;string&nbsp;timestamp&nbsp;=&nbsp;Convert.ToString(Request[\"timestamp\"]);\r\n&nbsp;string&nbsp;nonce&nbsp;=&nbsp;Convert.ToString(Request[\"nonce\"]);\r\n&nbsp;string[]&nbsp;ArrTmp&nbsp;=&nbsp;{&nbsp;Token,&nbsp;timestamp,&nbsp;nonce&nbsp;};\r\n&nbsp;Array.Sort(ArrTmp);&nbsp;\/\/\u5b57\u5178\u6392\u5e8f&nbsp;\r\n&nbsp;string&nbsp;tmpStr&nbsp;=&nbsp;string.Join(\"\",&nbsp;ArrTmp);\r\n&nbsp;tmpStr&nbsp;=&nbsp;FormsAuthentication.HashPasswordForStoringInConfigFile(tmpStr,&nbsp;\"SHA1\");\r\n&nbsp;tmpStr&nbsp;=&nbsp;tmpStr.ToLower();\r\n&nbsp;if&nbsp;(tmpStr&nbsp;==&nbsp;signature)\r\n&nbsp;{\r\n&nbsp;return&nbsp;true;\r\n&nbsp;}\r\n&nbsp;else\r\n&nbsp;{\r\n&nbsp;return&nbsp;false;\r\n&nbsp;}\r\n&nbsp;}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7136\u540e\uff0c\u516c\u4f17\u5e73\u53f0\u5728\u6709\u6743\u9650\u7684\u60c5\u51b5\u4e0b\u662f\u81ea\u5b9a\u4e49\u83dc\u5355\u7684\uff0c\u4f46\u662f\u4e00\u65e6\u5f00\u59cb\u81ea\u5b9a\u4e49\u83dc\u5355\uff0c\u539f\u6765\u7684\u624b\u52a8\u7f16\u8f91\u7684\u83dc\u5355\u662f\u4e0d\u80fd\u7528\u7684\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u5982\u679c\u670d\u52a1\u5668\u9a8c\u8bc1\u901a\u8fc7\uff0c\u90a3\u4e48\u5fc5\u987b\u7528\u81ea\u5df1\u7684\u4ee3\u7801\u63a7\u5236\u3002&nbsp;<\/p>\n<p>\u6211\u4eec\u4e00\u8d77\u6765\u770bGetMenuList()\u8fd9\u4e2a\u65b9\u6cd5\uff0c\u8fd9\u4e2a\u5176\u5b9e\u5f88\u7b80\u5355\u7684\uff0c\u5c31\u662f\u968f\u4fbf\u51ed\u501f\u4e00\u4e2aJSON\u683c\u5f0f\u5b57\u7b26\u4e32\u3002\u7136\u540e\u8c03\u7528\u5fae\u4fe1\u7684\u63a5\u53e3\u5373\u53ef\u3002&nbsp; public void GetMenuList()&nbsp;&nbsp;&nbsp;<\/p>\n<p><\/p>\n<pre>&lt;em&gt;&nbsp;{&nbsp;\r\n&nbsp;string&nbsp;weixin1&nbsp;=&nbsp;\"\";&nbsp;\r\n&nbsp;weixin1&nbsp;=&nbsp;@\"&nbsp;{&nbsp;\r\n&nbsp;\"\"button\"\":[&nbsp;\r\n&nbsp;{&nbsp;\r\n&nbsp;\"\"type\"\":\"\"click\"\",&nbsp;\r\n&nbsp;\"\"name\"\":\"\"\u4f60\u597d!\"\",&nbsp;\r\n&nbsp;\"\"key\"\":\"\"hello\"\"&nbsp;\r\n&nbsp;},&nbsp;\r\n&nbsp;{&nbsp;\r\n&nbsp;\"\"type\"\":\"\"view\"\",&nbsp;\r\n&nbsp;\"\"name\"\":\"\"\u516c\u53f8\u7b80\u4ecb\"\",&nbsp;\r\n&nbsp;\"\"url\"\":\"\"http:\/\/www.xnfhtech.com\"\"&nbsp;\r\n&nbsp;},&nbsp;\r\n&nbsp;{&nbsp;\r\n&nbsp;\"\"name\"\":\"\"\u4ea7\u54c1\u4ecb\u7ecd\"\",&nbsp;\r\n&nbsp;\"\"sub_button\"\":[&nbsp;\r\n&nbsp;{&nbsp;\r\n&nbsp;\"\"type\"\":\"\"click\"\",&nbsp;\r\n&nbsp;\"\"name\"\":\"\"\u4ea7\u54c11\"\",&nbsp;\r\n&nbsp;\"\"key\"\":\"\"p1\"\"&nbsp;\r\n&nbsp;},&nbsp;\r\n&nbsp;{&nbsp;\r\n&nbsp;\"\"type\"\":\"\"click\"\",&nbsp;\r\n&nbsp;\"\"name\"\":\"\"\u4ea7\u54c12\"\",&nbsp;\r\n&nbsp;\"\"key\"\":\"\"p2\"\"&nbsp;\r\n\r\n&nbsp;}]&nbsp;\r\n&nbsp;}]&nbsp;}\";&nbsp;\r\n\r\n&nbsp;\r\n\r\n&nbsp;string&nbsp;access_token&nbsp;=&nbsp;Tools.WA_GetAccess_Token.IsExistAccess_Token();&nbsp;\r\n&nbsp;string&nbsp;i&nbsp;=&nbsp;this.MenuCreate(menu,&nbsp;access_token);&nbsp;\r\n&nbsp;Response.Write(i);&nbsp;\r\n&nbsp;}&lt;br&gt;&lt;br&gt;&lt;\/em&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><\/p>\n<pre>&nbsp;public&nbsp;string&nbsp;MenuCreate(string&nbsp;MenuJson,&nbsp;string&nbsp;access_token)\r\n&nbsp;{\r\n&nbsp;JavaScriptSerializer&nbsp;Jss&nbsp;=&nbsp;new&nbsp;JavaScriptSerializer();\r\n&nbsp;string&nbsp;setMenuUrl&nbsp;=&nbsp;\"https:\/\/api.weixin.qq.com\/cgi-bin\/menu\/create?access_token={0}\";\r\n&nbsp;setMenuUrl&nbsp;=&nbsp;string.Format(setMenuUrl,&nbsp;access_token);\/\/\u83b7\u53d6token\u3001\u62fc\u51d1url\r\n&nbsp;string&nbsp;respText&nbsp;=&nbsp;WebRequestPostOrGet(setMenuUrl,&nbsp;MenuJson);\r\n&nbsp;Dictionary&lt;string&gt;&nbsp;respDic&nbsp;=&nbsp;(Dictionary&lt;string&gt;)Jss.DeserializeObject(respText);\r\n&nbsp;return&nbsp;respDic[\"errcode\"].ToString();\/\/\u8fd4\u56de0\u53d1\u5e03\u6210\u529f\r\n&nbsp;}\r\n\r\n&nbsp;\r\n\r\n\/\/\/&nbsp;&lt;summary&gt;\r\n&nbsp;\/\/\/&nbsp;Post\/get&nbsp;\u63d0\u4ea4\u8c03\u7528\u6293\u53d6\r\n&nbsp;\/\/\/&nbsp;&lt;\/summary&gt;\r\n&nbsp;\/\/\/&nbsp;&lt;param&gt;\u63d0\u4ea4\u5730\u5740\r\n&nbsp;\/\/\/&nbsp;&lt;param&gt;\u53c2\u6570\r\n&nbsp;\/\/\/&nbsp;&lt;returns&gt;string&lt;\/returns&gt;\r\n&nbsp;public&nbsp;string&nbsp;WebRequestPostOrGet(string&nbsp;sUrl,&nbsp;string&nbsp;sParam)\r\n&nbsp;{\r\n&nbsp;byte[]&nbsp;bt&nbsp;=&nbsp;System.Text.Encoding.UTF8.GetBytes(sParam);\r\n&nbsp;Uri&nbsp;uriurl&nbsp;=&nbsp;new&nbsp;Uri(sUrl);\r\n&nbsp;HttpWebRequest&nbsp;req&nbsp;=&nbsp;(HttpWebRequest)HttpWebRequest.Create(uriurl);\/\/HttpWebRequest&nbsp;req&nbsp;=&nbsp;(HttpWebRequest)HttpWebRequest.Create(url&nbsp;+&nbsp;(url.IndexOf(\"?\")&nbsp;&amp;gt;&nbsp;-1&nbsp;?&nbsp;\"\"&nbsp;:&nbsp;\"?\")&nbsp;+&nbsp;param);\r\n&nbsp;req.Method&nbsp;=&nbsp;\"Post\";\r\n&nbsp;req.Timeout&nbsp;=&nbsp;120&nbsp;*&nbsp;1000;\r\n&nbsp;req.ContentType&nbsp;=&nbsp;\"application\/x-www-form-urlencoded;\";\r\n&nbsp;req.ContentLength&nbsp;=&nbsp;bt.Length;\r\n\r\n&nbsp;using&nbsp;(Stream&nbsp;reqStream&nbsp;=&nbsp;req.GetRequestStream())\/\/using&nbsp;\u4f7f\u7528\u53ef\u4ee5\u91ca\u653eusing\u6bb5\u5185\u7684\u5185\u5b58\r\n&nbsp;{\r\n&nbsp;reqStream.Write(bt,&nbsp;0,&nbsp;bt.Length);\r\n&nbsp;reqStream.Flush();\r\n&nbsp;}\r\n&nbsp;try\r\n&nbsp;{\r\n&nbsp;using&nbsp;(WebResponse&nbsp;res&nbsp;=&nbsp;req.GetResponse())\r\n&nbsp;{\r\n&nbsp;\/\/\u5728\u8fd9\u91cc\u5bf9\u63a5\u6536\u5230\u7684\u9875\u9762\u5185\u5bb9\u8fdb\u884c\u5904\u7406\r\n&nbsp;Stream&nbsp;resStream&nbsp;=&nbsp;res.GetResponseStream();\r\n&nbsp;StreamReader&nbsp;resStreamReader&nbsp;=&nbsp;new&nbsp;StreamReader(resStream,&nbsp;System.Text.Encoding.UTF8);\r\n&nbsp;string&nbsp;resLine;\r\n&nbsp;System.Text.StringBuilder&nbsp;resStringBuilder&nbsp;=&nbsp;new&nbsp;System.Text.StringBuilder();\r\n&nbsp;while&nbsp;((resLine&nbsp;=&nbsp;resStreamReader.ReadLine())&nbsp;!=&nbsp;null)\r\n&nbsp;{\r\n&nbsp;&nbsp;resStringBuilder.Append(resLine&nbsp;+&nbsp;System.Environment.NewLine);\r\n&nbsp;}\r\n&nbsp;resStream.Close();\r\n&nbsp;resStreamReader.Close();\r\n&nbsp;return&nbsp;resStringBuilder.ToString();\r\n\r\n&nbsp;}\r\n\r\n&nbsp;}\r\n&nbsp;catch&nbsp;(Exception&nbsp;ex)\r\n&nbsp;{\r\n&nbsp;return&nbsp;ex.Message;\/\/url\u9519\u8bef\u65f6\u5019\u56de\u62a5\u9519\r\n&nbsp;}\r\n\r\n&nbsp;}&lt;\/string&gt;&lt;\/string&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u597d\u5427\uff0c\u6211\u627f\u8ba4\u6211\u662f\u4e00\u4e2a\u4e0d\u660e\u771f\u76f8\u7684\u5403\u8d27\uff0c\u600e\u4e48\u53c8\u591a\u4e86\u4e00\u4e2aaccess_token=IsExistAccess_Token();\u5462\uff0c\u83ab\u7740\u6025\uff0c\u5b9d\u5b9d\u544a\u8bc9\u4f60\u3002<\/p>\n<p>\u5f53\u6211\u4eec\u9605\u8bfb\u6587\u6863\u7684\u65f6\u5019\uff0c\u6211\u4eec\u4f1a\u53d1\u73b0\uff0c\u8fd9\u91cc\u7684Access_Token\u662f\u6bcf\u4e24\u4e2a\u5c0f\u65f6\u5c31\u8fc7\u671f\u7684\u3002\u8fd9\u91cc\u7684\u65b9\u6cd5\u5c31\u662f\u8ba9\u4ed6\u8fc7\u671f\u7684\u65f6\u5019\u81ea\u52a8\u83b7\u53d6\u3002&nbsp;<\/p>\n<p><strong>\u7b2c\u4e94\u5751<\/strong>\uff0c\u8fd9\u91cc\u7684JSON\u5b57\u7b26\u4e32\uff0c\u4e5f\u5c31\u662f\u8981\u5c55\u793a\u7684\u83dc\u5355\uff0c\u6211\u5e0c\u671b\u5927\u5bb6\u90fd\u7528\u5c0f\u5199\uff0c\u5982\u679c\u7528\u4e86\u5927\u5199\uff0c\u90a3\u4e48\uff0c\u5475\u5475\uff0c\u54c8\u54c8\u4e86\u771f\u5fc3\u7684\uff0c\u5f88\u64cd\u86cb\u7684\uff0c\u4ed6\u4f1a\u544a\u8bc9\u4f60\u6ca1\u6709\u7528UTF8\u7f16\u7801\uff0c\u4f46\u662f\u4f60\u771f\u5fc3\u662f\u7f16\u7801\u8fc7\u7684\uff0c\u53ef\u60dc\u8fd8\u662f\u51fa\u9519\uff0c\u6240\u4ee5\uff0c\u8fd8\u662f\u5c0f\u5199\u5427\uff0c\u5509&nbsp;<\/p>\n<p>\u7ee7\u7eed\u8bf4\u4e24\u4e2a\u5c0f\u65f6\u81ea\u52a8\u83b7\u53d6\u4e4b\u540e\uff0c\u5c31\u662f\u901a\u8fc7MenuCreate\uff08\u8c03\u7528\u5fae\u4fe1\u83dc\u5355\u63a5\u53e3\uff09\u8f93\u51fa\u5373\u53ef\u3002\u4e0a\u4ee3\u7801\u3002&nbsp;<\/p>\n<p><\/p>\n<pre>\/\/\/&nbsp;&lt;summary&gt;\r\n\/\/\/&nbsp;\u9632\u6b62\u6bcf\u6b21\u8bf7\u6c42\u7684token\u4e24\u4e2a\u5c0f\u65f6\u7684\u53d8\u5316\r\n\/\/\/&nbsp;&lt;\/summary&gt;\r\npublic&nbsp;class&nbsp;WA_GetAccess_Token\r\n{\r\n&nbsp;public&nbsp;WA_GetAccess_Token()\r\n&nbsp;{\r\n&nbsp;}\r\n&nbsp;public&nbsp;static&nbsp;WAEntity.Access_token&nbsp;GetAccess_Token()\r\n&nbsp;{\r\n&nbsp;string&nbsp;url&nbsp;=&nbsp;\"https:\/\/api.weixin.qq.com\/cgi-bin\/token?grant_type=client_credential&amp;amp;appid=\"+&nbsp;ConfigurationManager.AppSettings[\"AppID\"]&nbsp;+&nbsp;\"&amp;amp;secret=\"+&nbsp;ConfigurationManager.AppSettings[\"AppSecret\"];\r\n&nbsp;Access_token&nbsp;entity&nbsp;=&nbsp;new&nbsp;Access_token();\r\n&nbsp;try\r\n&nbsp;{\r\n&nbsp;HttpWebRequest&nbsp;req&nbsp;=&nbsp;(HttpWebRequest)HttpWebRequest.Create(url);\r\n&nbsp;req.Method&nbsp;=&nbsp;\"GET\";\r\n&nbsp;using&nbsp;(WebResponse&nbsp;wr&nbsp;=&nbsp;req.GetResponse())\r\n&nbsp;{\r\n&nbsp;HttpWebResponse&nbsp;myResponse&nbsp;=&nbsp;(HttpWebResponse)req.GetResponse();\r\n&nbsp;StreamReader&nbsp;reader&nbsp;=&nbsp;new&nbsp;StreamReader(myResponse.GetResponseStream(),&nbsp;System.Text.Encoding.UTF8);\r\n&nbsp;string&nbsp;content&nbsp;=&nbsp;reader.ReadToEnd();\r\n&nbsp;Access_token&nbsp;token&nbsp;=&nbsp;new&nbsp;Access_token();\r\n&nbsp;token&nbsp;=&nbsp;JsonHelper.ParseFromJson&lt;access_token&gt;(content);\r\n&nbsp;entity.access_token&nbsp;=&nbsp;token.access_token;\r\n&nbsp;entity.expires_in&nbsp;=&nbsp;token.expires_in;\r\n&nbsp;}\r\n\r\n&nbsp;}\r\n\r\n&nbsp;catch{&nbsp;\/\/\u8bb0\u5f55\u65e5\u5fd7}\r\n&nbsp;return&nbsp;entity;\r\n\r\n&nbsp;}\r\n\r\n&nbsp;\/\/\/&nbsp;&lt;summary&gt;&nbsp;\r\n&nbsp;\/\/\/&nbsp;\u6839\u636e\u5f53\u524d\u65e5\u671f&nbsp;\u5224\u65adAccess_Token&nbsp;\u662f\u5426\u8d85\u671f&nbsp;\u5982\u679c\u8d85\u671f\u8fd4\u56de\u65b0\u7684Access_Token&nbsp;\u5426\u5219\u8fd4\u56de\u4e4b\u524d\u7684Access_Token&nbsp;\r\n&nbsp;\/\/\/&nbsp;&lt;\/summary&gt;&nbsp;\r\n&nbsp;\/\/\/&nbsp;&lt;param&gt;&nbsp;\r\n&nbsp;\/\/\/&nbsp;&lt;returns&gt;&lt;\/returns&gt;&nbsp;\r\n&nbsp;public&nbsp;static&nbsp;string&nbsp;IsExistAccess_Token()\r\n&nbsp;{\r\n&nbsp;try\r\n&nbsp;{\r\n&nbsp;string&nbsp;Token&nbsp;=&nbsp;string.Empty;\r\n&nbsp;DateTime&nbsp;YouXRQ;\r\n&nbsp;\/\/\u8bfb\u53d6XML\u6587\u4ef6\u4e2d\u7684\u6570\u636e\uff0c\u5e76\u663e\u793a\u51fa\u6765\r\n&nbsp;string&nbsp;filepath&nbsp;=&nbsp;HttpContext.Current.Request.MapPath(\"~\/XMLFile.xml\");\r\n&nbsp;StreamReader&nbsp;str&nbsp;=&nbsp;new&nbsp;StreamReader(filepath,&nbsp;System.Text.Encoding.UTF8);\r\n&nbsp;XmlDocument&nbsp;xml&nbsp;=&nbsp;new&nbsp;XmlDocument();\r\n&nbsp;xml.Load(str);\r\n&nbsp;str.Close();\r\n&nbsp;str.Dispose();\r\n&nbsp;Token&nbsp;=&nbsp;xml.SelectSingleNode(\"xml\").SelectSingleNode(\"Access_Token\").InnerText;\r\n&nbsp;YouXRQ&nbsp;=&nbsp;Convert.ToDateTime(xml.SelectSingleNode(\"xml\").SelectSingleNode(\"Access_YouXRQ\").InnerText);\r\n&nbsp;if&nbsp;(DateTime.Now&nbsp;&amp;gt;&nbsp;YouXRQ)\r\n&nbsp;{\r\n\r\n&nbsp;DateTime&nbsp;_youxrq&nbsp;=&nbsp;DateTime.Now;\r\n&nbsp;WAEntity.Access_token&nbsp;mode&nbsp;=&nbsp;GetAccess_Token();\r\n&nbsp;xml.SelectSingleNode(\"xml\").SelectSingleNode(\"Access_Token\").InnerText&nbsp;=&nbsp;mode.access_token;\r\n&nbsp;_youxrq&nbsp;=&nbsp;_youxrq.AddSeconds(Convert.ToInt32(mode.expires_in));\r\n&nbsp;xml.SelectSingleNode(\"xml\").SelectSingleNode(\"Access_YouXRQ\").InnerText&nbsp;=&nbsp;_youxrq.ToString();\r\n&nbsp;xml.Save(filepath);\r\n&nbsp;Token&nbsp;=&nbsp;mode.access_token;\r\n&nbsp;}\r\n\r\n&nbsp;return&nbsp;Token;\r\n&nbsp;}\r\n&nbsp;catch&nbsp;(Exception&nbsp;ex)\r\n&nbsp;{\r\n&nbsp;return&nbsp;\"\";\/\/\u8bb0\u5f55\u65e5\u5fd7\r\n&nbsp;}\r\n\r\n&nbsp;}\r\n\r\n}\r\n\r\n&nbsp;\r\n\r\npublic&nbsp;class&nbsp;Access_token\r\n{\r\n&nbsp;public&nbsp;Access_token()\r\n&nbsp;{&nbsp;}\r\n&nbsp;public&nbsp;string&nbsp;access_token&nbsp;{&nbsp;get;&nbsp;set;&nbsp;}\r\n&nbsp;public&nbsp;string&nbsp;expires_in&nbsp;{&nbsp;get;&nbsp;set;&nbsp;}\r\n\r\n}\r\n\r\n&nbsp;\r\n\r\npublic&nbsp;class&nbsp;JsonHelper\r\n{\r\n&nbsp;\/\/\/&nbsp;&lt;summary&gt;&nbsp;\r\n&nbsp;\/\/\/&nbsp;\u751f\u6210Json\u683c\u5f0f&nbsp;\r\n&nbsp;\/\/\/&nbsp;&lt;\/summary&gt;&nbsp;\r\n&nbsp;\/\/\/&nbsp;&lt;typeparam&gt;&lt;\/typeparam&gt;&nbsp;\r\n&nbsp;\/\/\/&nbsp;&lt;param&gt;&nbsp;\r\n&nbsp;\/\/\/&nbsp;&lt;returns&gt;&lt;\/returns&gt;&nbsp;\r\n&nbsp;public&nbsp;static&nbsp;string&nbsp;GetJson&lt;t&gt;(T&nbsp;obj)\r\n\r\n&nbsp;{\r\n&nbsp;DataContractJsonSerializer&nbsp;json&nbsp;=&nbsp;new&nbsp;DataContractJsonSerializer(obj.GetType());\r\n&nbsp;using&nbsp;(MemoryStream&nbsp;stream&nbsp;=&nbsp;new&nbsp;MemoryStream())\r\n&nbsp;{\r\n&nbsp;json.WriteObject(stream,&nbsp;obj);\r\n&nbsp;string&nbsp;szJson&nbsp;=&nbsp;Encoding.UTF8.GetString(stream.ToArray());&nbsp;return&nbsp;szJson;\r\n&nbsp;}\r\n&nbsp;}\r\n&nbsp;\/\/\/&nbsp;&lt;summary&gt;&nbsp;\r\n&nbsp;\/\/\/&nbsp;\u83b7\u53d6Json\u7684Model&nbsp;\r\n&nbsp;\/\/\/&nbsp;&lt;\/summary&gt;&nbsp;\r\n&nbsp;\/\/\/&nbsp;&lt;typeparam&gt;&lt;\/typeparam&gt;&nbsp;\r\n&nbsp;\/\/\/&nbsp;&lt;param&gt;&nbsp;\r\n&nbsp;\/\/\/&nbsp;&lt;returns&gt;&lt;\/returns&gt;&nbsp;\r\n&nbsp;public&nbsp;static&nbsp;T&nbsp;ParseFromJson&lt;t&gt;(string&nbsp;szJson)\r\n&nbsp;{\r\n&nbsp;T&nbsp;obj&nbsp;=&nbsp;Activator.CreateInstance&lt;t&gt;();\r\n&nbsp;using&nbsp;(MemoryStream&nbsp;ms&nbsp;=&nbsp;new&nbsp;MemoryStream(Encoding.UTF8.GetBytes(szJson)))\r\n&nbsp;{\r\n&nbsp;DataContractJsonSerializer&nbsp;serializer&nbsp;=&nbsp;new&nbsp;DataContractJsonSerializer(obj.GetType());\r\n&nbsp;return&nbsp;(T)serializer.ReadObject(ms);\r\n&nbsp;}\r\n&nbsp;}\r\n\r\n}&lt;\/t&gt;&lt;\/t&gt;&lt;\/t&gt;&lt;\/access_token&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u539f\u8c05\u6211\u53c8\u4e0d\u660e\u771f\u76f8\u4e86\uff0c\u6240\u8c13\u7684XMLFile.xml\u8fd9\u53c8\u662f\u4ec0\u4e48\u9b3c\uff0c\u597d\u5427\uff0c\u6211\u5176\u5b9e\u4e0d\u60f3\u8bf4\u7684\u8fd9\u4e48\u76f4\u767d\u7684\uff0c\u8fd8\u662f\u4ee3\u7801\u76f4\u63a5\u4e0a\u6bd4\u8f83\u597d\u3002<\/p>\n<p><\/p>\n<pre>&lt;?xml  version=\"1.0\" encoding=\"utf-8\"?&gt;&lt;xml&gt;\r\n&nbsp;&lt;access_token&gt;\u83b7\u53d6TOKEN&lt;\/access_token&gt;\r\n&nbsp;&lt;access_youxrq&gt;2015\/9\/12&nbsp;17:56:31&lt;\/access_youxrq&gt;&lt;\/xml&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fphp\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1\u524d\u7684\u95ee\u9898\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>\u8fd9\u7bc7\u6587\u7ae0\u4e3b\u8981\u4e3a\u5927\u5bb6\u8be6\u7ec6\u4ecb\u7ecd\u4e86php\u5fae\u4fe1\u516c\u4f17\u8d26\u53f7\u5f00\u53d1\u4e4b\u524d\u4e94\u4e2a\u5751,\u5177\u6709\u4e00\u5b9a\u7684\u53c2\u8003\u4ef7\u503c\uff0c\u611f\u5174\u8da3\u7684\u5c0f\u4f19\u4f34\u4eec\u53ef\u4ee5\u53c2\u8003\u4e00\u4e0b \u5fae\u4fe1\u516c\u4f17\u8d26\u53f7\u5f00\u53d1\u6587\u6863\uff0c\u5b98\u65b9\u7248\uff08https:\/\/mp.weixin.qq.com\/wiki\uff09 \u9996\u5148\uff0c\u4f60\u5f97\u6709\u4e00\u4e2a\u516c\u4f17\u5e73\u53f0\u8d26\u53f7\uff0c\u597d\u4e86\uff0c\u5f00\u59cb\u8ba1\u5751\u3002&nbsp; \u7b2c\u4e00\u5751\uff0c\u4e0d\u8981\u4ee5\u4e3a\u4e0d\u662f\u4f01\u4e1a\u53f7\u5c31\u4e0d\u80fd\u5f00\u53d1\u4e86\uff0c\u53ef\u4ee5\u7533\u8bf7\u6d4b\u8bd5\u53f7\u7684\uff0c\u6bd4\u6240\u8c13\u7684\u8ba2\u9605\u53f7\u63a5\u53e3\u591a\u591a\u4e86\u3002 &nbsp; \u8fdb\u5165\u540e\u53f0\u7ba1\u7406\u4e4b\u540e\uff0c\u70b9\u51fb\u5f00\u53d1\u8005\u5de5\u5177\uff0c\u53ef\u4ee5\u770b\u5230\u516c\u4f17\u5e73\u53f0\u6d4b\u8bd5\u8d26\u53f7\uff0c\u76f4\u63a5\u8fdb\u5165\u5373\u53ef\u3002\u5f00\u59cb\u586b\u5199\u81ea\u5df1\u7684\u914d\u7f6e\u3002&nbsp; \u6ce8\u610f\u6d82\u9e26\u90e8\u5206\uff0c\u8fd9\u90e8\u5206\u662f\u7a0b\u5e8f\u4e2d\u5fc5\u987b\u8981\u914d\u7f6e\u7684\u4e1c\u4e1c\uff0c\u5982\u679c\u6ca1\u6709\u914d\u7f6e\u7684\u8bdd\uff0c\u8fd9\u662f\u4e00\u5b9a\u4e0d\u6210\u529f\u7684\u3002&nbsp; \u7b2c\u4e8c\u5751\uff0c\u5f53\u7136\uff0c\u4f60\u8fd9\u4e48\u914d\u7f6e\u4e5f\u4e00\u5b9a\u662f\u4e0d\u6210\u529f\u7684\uff0c\u4e0d\u8981\u95ee\u6211\u4e3a\u4ec0\u4e48\u3002\u6ca1\u56fe\u8bf4\u4e2a\u51e0\u628a\u3002\u3002\u3002&nbsp; \u8bf7\u4e0d\u8981\u8ba4\u4e3a\u4f01\u9e45\u5e1d\u95f9\u7740\u73a9\uff0c\u8fd9\u662f\u771f\u7684\uff0c\u5fc5\u987b\u662f80\u7aef\u53e3\uff0c\u5176\u5b9e\u4e5f\u5c31\u53d1\u5e03\u4e00\u4e2a\u57df\u540d\u7684\u7f51\u7ad9\u5373\u53ef\u3002\u56e0\u4e3a\u57df\u540d\u7684\u7f51\u7ad9\u90fd\u662f80\u7aef\u53e3\u51fa\u6765\u7684\uff0c\u7ee7\u7eed\u8bf4\u6b63\u9898\u3002&nbsp; \u4f01\u9e45\u5e1d\u544a\u8bc9\u6211\u4eec\uff0c\u8981\u7528\u5fae\u4fe1\u8d26\u53f7\uff0c\u5fc5\u987b\u6709\u4e00\u53f0\u670d\u52a1\u5668\uff0c\u7136\u540e\u914d\u7f6e\u6211\u4eec\u53d1\u5e03\u7684\u7f51\u7ad9\u5c31\u884c\u4e86\uff0c\u8bf7\u6ce8\u610f\uff0ctoken\u662f\u81ea\u5df1\u8bbe\u5b9a\u7684\uff0c\u8fd9\u4e2a\u4e0d\u662f\u81ea\u52a8\u751f\u6210\u7684\uff0c\u81ea\u5df1\u8bbe\u5b9a\u3002\u3002URL\u5c31\u662f\u6211\u4eec\u53d1\u5e03\u7684\u7f51\u7ad9\u540d\u79f0&nbsp; \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u7b2c\u4e09\u5751\uff0c\u7f51\u7ad9\u4e0d\u53d1\u5e03\uff0c\u63a5\u53e3\u914d\u7f6e\u4fe1\u606f\u662f\u6c38\u8fdc\u914d\u7f6e\u4e0d\u8fc7\u53bb\u7684\uff0c\u8bb0\u4f4f\uff0c\u662f\u6c38\u8fdc\u3002&nbsp; JS\u63a5\u53e3\u5b89\u5168\u57df\u540d\u7684\u76ee\u7684\u662f\u4e3a\u4e86\u4e0b\u8f7d\u56fe\u7247\uff0c\u8c03\u7528\u5fae\u4fe1\u56fe\u7247\u63a5\u53e3\u7b49\u7b49\uff0c\u6bd4\u5982\u5f53\u4f60\u9700\u8981\u8c03\u7528\u6444\u50cf\u5934\u7684\u65f6\u5019\uff0c\u6216\u8005\u8bf4\u8bf4\u9700\u8981\u4e0a\u4f20\u7167\u7247\u7684\u65f6\u5019\uff0c\u8fd9\u65f6\u5019\u5c31\u9700\u8981JS\u5b89\u5168\u63a5\u53e3\u4e86\uff0c\u5173\u4e8e\u5177\u4f53\u7684\u5185\u5bb9\u6682\u4e0d\u505a\u8be6\u7ec6\u63cf\u8ff0\u3002&nbsp; \u5728\u5fae\u4fe1\u516c\u4f17\u8d26\u53f7\u6d4b\u8bd5\u53f7\u7684\u7248\u672c\u540e\u53f0\u4e2d\uff0c\u6709\u4e00\u4e2a\u4f53\u9a8c\u63a5\u53e3\u6743\u9650\u8868\u91cc\u9762\u7684\u8fd9\u4e00\u9879\u4e5f\u662f\u5fc5\u987b\u914d\u7f6e\u7684\u3002\u4e5f\u4e0d\u7b97\u662f\u5fc5\u987b\u914d\u7f6e\uff0c\u800c\u662f\u8fd9\u4e2a\u63a5\u53e3\u53ef\u4ee5\u83b7\u53d6\u5230\u5fae\u4fe1\u7528\u6237\u7684\u90e8\u5206\u4fe1\u606f\u3002\u503c\u5f97\u63d0\u9192\u7684\u662f\u6bcf\u4e2a\u516c\u4f17\u8d26\u53f7\u5bf9\u5e94\u7684\u6bcf\u4e2aID\u662f\u552f\u4e00\u7684\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u5373\u4fbf\u7f51\u7ad9\u5185\u7f51\u4e0d\u53d8\uff0c\u5982\u679c\u6362\u4e86\u516c\u4f17\u53f7\uff0c\u90a3\u4e48\uff0c\u8fd9\u65f6\u5019\u7684\u5fae\u4fe1\u516c\u4f17\u53f7\u7684\u6570\u636e\u662f\u4e0d\u80fd\u5171\u901a\u7684\uff0c\u53ea\u662f\u76f8\u5bf9\u516c\u5171\u53f7\u552f\u4e00\u3002&nbsp; \u7b2c\u56db\u5751\uff0c\u7533\u8bf7\u5fae\u4fe1\u7f51\u9875\u6388\u6743\u7684\u65f6\u5019\uff0c\u8fd9\u91cc\u7684\u7f51\u9875\u6388\u6743\u7528\u6237\u57fa\u672c\u4fe1\u606f\uff0c\u8fd9\u4e2a\u672c\u8eab\u6ca1\u95ee\u9898\uff0c\u4f46\u662f\u6ca1\u6709\u63d0\u793a\u5c31\u6709\u95ee\u9898\u4e86\u3002&nbsp; \u8fd9\u91cc\u7684\u7f51\u5740\uff0c\u8bf7\u6ce8\u610f\uff0c\u4e00\u5b9a\u662f\u4e0d\u542bwww\u7684\uff0c\u800c\u4e14\u540e\u9762\u6ca1\u6709\u53cd\u659c\u6760\uff0c\u4e5f\u5c31\u662f\u8bf4\u8fd9\u91cc\u7684\u7f51\u5740\u7684\u56de\u8c03\u683c\u5f0f\u662f&nbsp; abc.com OK\uff0c\u8bf7\u8bb0\u4f4f\u8fd9\u4e2a\u683c\u5f0f\uff0c\u5fc5\u987b\u8fd9\u4e48\u5e72\u3002\u597d\u4e86\uff0c\u670d\u52a1\u5668\u6682\u4e14\u8fd9\u6837\uff0c\u6682\u5f00\u59cb\u7528\u4ee3\u7801\u8bf4\u8bdd\u3002&nbsp; \u9996\u5148\u4ece\u670d\u52a1\u5668\u9a8c\u8bc1\u8bf4\u8d77\u3002\u8fd9\u4e2a\u5728\u5b98\u7f51\u662f\u6709\u4f8b\u5b50\u7684\uff0c\u4e0d\u8fc7\u662fPHP\u7684\uff0c\u5176\u5b9e\u8bf4\u767d\u4e86\u9996\u5148\u5c31\u662f\u9a8c\u8bc1\u4e00\u4e2a\u968f\u673a\u6570\uff0c\u7136\u540e\u5728POST\u7684\u60c5\u51b5\u4e0b\uff0c\u68c0\u6d4b\u8fd4\u56de\u503c\u5373\u53ef\u3002\u76f4\u63a5\u4e0a\u4ee3\u7801&nbsp; &nbsp;public&nbsp;ActionResult&nbsp;Index() &nbsp;{ &nbsp;if&nbsp;(Request.HttpMethod.ToLower()&nbsp;==&nbsp;&#8220;post&#8221;) &nbsp;{ &nbsp;if&nbsp;(CheckSignature())\/\/\u9a8c\u8bc1\u670d\u52a1\u5668\u662f\u5426\u901a\u8fc7 &nbsp;{ &nbsp;GetMenuList();\/\/\u52a0\u8f7d\u83dc\u5355 &nbsp;} &nbsp;else &nbsp;{ &nbsp;Response.Write(&#8220;&lt;h1&gt;Oh&lt;\/h1&gt;&lt;h2&gt;\u6211\u4eec\u76f8\u9047\u5728\u706b\u661f\u5427\uff01\uff01\uff01&lt;\/h2&gt;&#8221;); &nbsp;Response.End(); &nbsp;} &nbsp;} &nbsp;else &nbsp;{ &nbsp;CheckWechat(); &nbsp;} &nbsp;return&nbsp;View(); &nbsp;} &nbsp; &nbsp;\/\/\/&nbsp;&lt;summary&gt; &nbsp;\/\/\/&nbsp;\u8fd4\u56de\u968f\u673a\u6570\u8868\u793a\u9a8c\u8bc1\u6210\u529f &nbsp;\/\/\/&nbsp;&lt;\/summary&gt; &nbsp;private&nbsp;void&nbsp;CheckWechat() &nbsp;{ &nbsp;if&nbsp;(string.IsNullOrEmpty(Request.QueryString[&#8220;echoStr&#8221;])) &nbsp;{ &nbsp;Response.Write(&#8220;\u6d88\u606f\u5e76\u975e\u6765\u81ea\u5fae\u4fe1&#8221;); &nbsp;Response.End(); &nbsp;} &nbsp;string&nbsp;echoStr&nbsp;=&nbsp;Request.QueryString[&#8220;echoStr&#8221;]; &nbsp;if&nbsp;(CheckSignature()) &nbsp;{ &nbsp;Response.Write(echoStr); &nbsp;Response.End(); [&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-29237","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/29237","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=29237"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/29237\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=29237"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=29237"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=29237"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}