{"id":2685,"date":"2022-01-25T03:57:00","date_gmt":"2022-01-24T19:57:00","guid":{"rendered":"https:\/\/blog.brain1981.com\/?p=2685"},"modified":"2022-01-25T04:05:17","modified_gmt":"2022-01-24T20:05:17","slug":"h5%e5%be%ae%e4%bf%a1%e5%88%86%e4%ba%abjs-%e5%90%8e%e7%ab%afphp%e5%ae%8c%e6%95%b4%e7%89%88%e4%bb%a3%e7%a0%81","status":"publish","type":"post","link":"https:\/\/blog.brain1981.com\/2685.html","title":{"rendered":"H5\u5fae\u4fe1\u5206\u4eabJS\/\u540e\u7aefPHP\u5b8c\u6574\u7248\u4ee3\u7801"},"content":{"rendered":"<p>\u6709\u5dee\u4e0d\u591a\u4e00\u5e74\u6ca1\u6709\u63a5H5\u7684\u5f00\u53d1\u4e86\uff0c\u6700\u8fd1\u53c8\u63a5\u4e86\u4e00\u4e2a\uff0c\u53d1\u73b0\u4ee5\u524d\u5199\u8fc7\u7684\u5fae\u4fe1\u5206\u4eab\u90e8\u5206\u4e0d\u7ba1\u7528\u4e86\uff0c\u8e29\u5751\uff0c\u53c8\u8e29\u5751\u4e86\uff01<\/p>\n<p>\u9996\u5148\u662f\u670d\u52a1\u53f7\u7684\u8bbe\u7f6e\u95ee\u9898\uff0c\u6211\u5df2\u7ecf\u5728\u8fd9\u7bc7\u8001\u7684\u535a\u5ba2\u91cc\u66f4\u65b0\uff1a<a href=\"https:\/\/blog.brain1981.com\/1784.html\" rel=\"noopener\" target=\"_blank\">https:\/\/blog.brain1981.com\/1784.html<\/a><br \/>\n\u6b64\u5904\u91cd\u590d\u4e00\u904d\u66f4\u65b0\u7684\u5185\u5bb9\uff0cIP\u5730\u5740\u767d\u540d\u5355\u4ece\u524d\u53ef\u4ee5\u4e0d\u586b\uff0c\u73b0\u5728\u5fc5\u987b\u586b\u5199\u4e86\uff0c\u8981\u4e0d\u7136\u6b7b\u6d3b\u8c03\u8bd5\u4e0d\u51fa\u5206\u4eab\uff0c\u5f00\u53d1\u8005\u5de5\u5177\u4f1a\u663e\u793a\u65e0\u6743\u9650\u83b7\u53d6access_token\uff01<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.brain1981.com\/wp-content\/uploads\/2022\/01\/ipwhitelist.jpg\" alt=\"\u670d\u52a1\u53f7\u540e\u53f0\u5fc5\u987b\u586b\u5199IP\u767d\u540d\u5355\" width=\"1141\" height=\"584\" class=\"alignnone size-full wp-image-2687\" srcset=\"https:\/\/blog.brain1981.com\/wp-content\/uploads\/2022\/01\/ipwhitelist.jpg 1141w, https:\/\/blog.brain1981.com\/wp-content\/uploads\/2022\/01\/ipwhitelist-300x154.jpg 300w, https:\/\/blog.brain1981.com\/wp-content\/uploads\/2022\/01\/ipwhitelist-1024x524.jpg 1024w, https:\/\/blog.brain1981.com\/wp-content\/uploads\/2022\/01\/ipwhitelist-768x393.jpg 768w, https:\/\/blog.brain1981.com\/wp-content\/uploads\/2022\/01\/ipwhitelist-624x319.jpg 624w\" sizes=\"auto, (max-width: 1141px) 100vw, 1141px\" \/><\/p>\n<p>\u7b2c\u4e8c\u4e2a\u5751\u662f\u5fae\u4fe1\u5df2\u7ecf\u66f4\u6539\u4e86\u5206\u4eab\u673a\u5236\uff0c<strong>\u5982\u679c\u4f60\u662f\u70b9\u51fbURL\u8fdb\u5165H5\u9875\u9762\uff0c\u90a3\u4e48\u8fd9\u65f6\u5019\u5373\u4f7f\u5206\u4eab\u8bf7\u6c42\u6b63\u786e\uff0c\u5206\u4eab\u51fa\u53bb\u7684\u90fd\u53ea\u80fd\u662f\u4e00\u4e2a\u6587\u672c\u7684URL\uff0c\u800c\u4e0d\u662f\u5361\u7247\u5f0f\u7684\u5206\u4eab\u683c\u5f0f<\/strong>\u3002\u76f8\u5173\u8ba8\u8bba\u548c\u901a\u77e5\u89c1\u8fd9\u4e2a\u94fe\u63a5\uff1a<a href=\"https:\/\/developers.weixin.qq.com\/community\/develop\/doc\/0000ea53f1cf60dcfc1da027a55c00\" rel=\"noopener\" target=\"_blank\">https:\/\/developers.weixin.qq.com\/community\/develop\/doc\/0000ea53f1cf60dcfc1da027a55c00<\/a><br \/>\n\u4e00\u5ea6\u6211\u8fd8\u4ee5\u4e3a\u662f\u5fae\u4fe1\u53c8\u51fa\u4e86\u4ec0\u4e48\u9690\u85cfbug\uff0c\u660e\u660edebug\u6a21\u5f0f\u548c\u5f00\u53d1\u8005\u5de5\u5177\u90fd\u663e\u793a\u5206\u4eab\u8bf7\u6c42\u6210\u529f\uff0c\u6b7b\u6d3b\u5206\u4eab\u4e0d\u51fa\u5361\u7247&#8230; \u8fd9\u4e5f\u662f\u5fae\u4fe1\u7684\u8001\u6bdb\u75c5\u4e86\uff0c\u4f60\u8bf4\u5b83\u6ca1\u901a\u77e5\u5f00\u53d1\u8005\u4e48\uff0c\u5012\u4e5f\u4e0d\u5c3d\u7136\uff0c\u4f46\u8fd9\u79cd\u653f\u7b56\u66f4\u6539\u7684\u901a\u77e5\u5c31\u662f\u4e0d\u7ed9\u4f60\u7528\u767d\u8bdd\u8bb2\u6e05\u695a\uff0c\u8981\u4f60\u81ea\u5df1\u53bb\u4f53\u4f1a\u6548\u679c\uff01<\/p>\n<p>\u6700\u540e\u4e00\u4e2a\u5751\uff0c\u662f\u6682\u65f6\u6ca1\u6709\u7206\u7684\uff0c\u4f46\u76f8\u4fe1\u5f88\u5feb\u4f1a\u7206\uff0c\u4e4b\u524d\u7684\u4e24\u4e2a\u5206\u4eab\u63a5\u53e3 wx.onMenuShareTimeline \u548c wx.onMenuShareAppMessage \u5373\u5c06\u88ab\u5e9f\u5f03\u4e86\u3002\u9700\u8981\u6362\u6210 wx.updateAppMessageShareData \u548c wx.updateTimelineShareData\uff0c \u8c03\u7528\u65b9\u5f0f\u548c\u53c2\u6570\u5927\u81f4\u6ca1\u53d8\u3002\u6ce8\u610f\u662f\u5927\u81f4\u6ca1\u53d8\uff0c\u5982\u679c\u53ea\u662f\u7167\u642c\u66ff\u6362\uff0c\u5f88\u53ef\u80fd\u53c8\u8981\u8e29\u5751\uff0c\u4e3a\u9020\u798f\u5e7f\u5927\u82e6\u903c\u7801\u519c\uff0c\u672c\u6587\u76f4\u63a5\u9644\u4e0a\u53ef\u4ee5\u76f4\u63a5\u62ff\u6765\u7528\u7684\u5206\u4eab\u4ee3\u7801\u3002<!--more--><\/p>\n<p><strong>\u5148\u662f\u524d\u7aef\u90e8\u5206\uff0c\u9700jQuery<\/strong><\/p>\n<pre lang=\"javascript\" line=\"1\">\r\nvar shareMsg = {\r\n\tappid:'wx******************',\r\n\ttitle: \"\u5206\u4eab\u6807\u9898\",\r\n\tdesc:\"\u5206\u4eab\u63cf\u8ff0\",\r\n\timage:'https:\/\/****\/share.png', \/\/\u5206\u4eab\u65b9\u5757\u5c0f\u56fe\uff0c\u5efa\u8bae150\u00d7150\u6b63\u65b9\u5f62\r\n\tlink: 'https:\/\/****'  \/\/\u5206\u4eab\u94fe\u63a5\uff0c\u5fc5\u987b\u548c\u5f53\u524d\u9875\u9762\u662f\u540c\u4e00\u4e2a\u57df\u540d\/\u5b50\u57df\u540d\u4e0b\u7684URL\r\n}\r\n\r\n\/\/getSign.php\u4e3a\u540e\u7aef\u6587\u4ef6\uff0c\u4ee3\u7801\u5728\u540e\u9762\r\nvar jsSignService = 'getSign.php';\r\nfunction weixin(appid,callback){\r\n\tvar _self = this;\r\n\tthis.appid = appid;\r\n\tthis.callback = callback;\r\n\t$.each(wx,function(k,v){\r\n\t\tweixin.prototype[k] = v;\r\n\t})\r\n\tfor(var k in wx) {\r\n\t\tweixin[k] = wx[k];\r\n\t}\r\n\tif(this.callback){\r\n\t\tthis.ready(this.callback);\r\n\t}\r\n\r\n\t$.getJSON(jsSignService,{'appid':this.appid,'url':location.href.split('#')[0]},function(response){\r\n\t\t_self.config({\r\n\t\t\tdebug: false, \/\/ \u5f00\u542f\u8c03\u8bd5\u6a21\u5f0f\r\n\t\t\tappId: response.appId,\r\n\t\t\ttimestamp: response.timestamp,\r\n\t\t\tnonceStr: response.nonceStr,\r\n\t\t\tsignature: response.signature,\r\n\t\t\tjsApiList: [\r\n\t\t\t\t'checkJsApi',\r\n\t\t\t\t'onMenuShareTimeline',\r\n\t\t\t\t'onMenuShareAppMessage',\r\n\t\t\t\t'onMenuShareQQ',\r\n\t\t\t\t'onMenuShareWeibo',\r\n\t\t\t\t'updateAppMessageShareData',\r\n\t\t\t\t'updateTimelineShareData',]\r\n\t\t});\r\n\t});\r\n}\r\n$(function(){\r\n\tvar wx = new weixin(shareMsg.appid,function(){\r\n\t\twx.error(function(res){\r\n\t\t\t\/\/\u7528\u4e8e\u67e5\u770b\u56de\u8c03\u5931\u8d25\u7684\u60c5\u5f62\uff0c\u8f85\u52a9debug\r\n\t\t\t\/\/alert(res);\r\n\t\t});\r\n\r\n\t\twx.ready(function() {\r\n\t\t\t\/\/\u5982\u679c\u9875\u9762\u6709\u80cc\u666f\u97f3\u4e50\uff0c\u53ef\u4ee5\u5728\u8fd9\u91cc\u76f4\u63a5\u5f00\u59cb\u64ad\u653e\uff0c\u65e0\u9700\u70b9\u51fb\uff08\u8d85\u8d8a\u624b\u673a\u6d4f\u89c8\u5668\u534f\u8bae\uff09\r\n\t\t\t\/\/document.getElementById(\"bg-music\").play();\r\n\t\t});\r\n\t\tchangeShareVal();\r\n\t});\r\n})\r\n\r\nfunction changeShareVal(){\r\n\t\/\/\u5fae\u4fe1\u597d\u53cb\/QQ\u597d\u53cb\/\u7fa4\u804a\r\n\twx.updateAppMessageShareData({\r\n\t\ttitle: shareMsg.title, \/\/ \u5206\u4eab\u6807\u9898\r\n\t\tdesc: shareMsg.desc,  \/\/ \u5206\u4eab\u63cf\u8ff0\r\n\t\tlink: shareMsg.link, \/\/ \u5206\u4eab\u94fe\u63a5\r\n\t\timgUrl: shareMsg.image, \/\/ \u5206\u4eab\u56fe\u6807\r\n\t\tsuccess: function () { \/\/ \u5206\u4eab\u6210\u529f\u540e\u56de\u8c03\r\n\t\t},\r\n\t\tcancel: function () { \/\/ \u5206\u4eab\u5931\u8d25\u540e\u56de\u8c03\r\n\t\t}\r\n\t});\r\n\t\/\/\u670b\u53cb\u5708\/QQ\u7a7a\u95f4\r\n\twx.updateTimelineShareData({\r\n\t\ttitle: shareMsg.title, \/\/ \u5206\u4eab\u6807\u9898\r\n\t\tdesc: shareMsg.desc,  \/\/ \u5206\u4eab\u63cf\u8ff0\r\n\t\tlink: shareMsg.link, \/\/ \u5206\u4eab\u94fe\u63a5\r\n\t\timgUrl: shareMsg.image, \/\/ \u5206\u4eab\u56fe\u6807\r\n\t\tsuccess: function () { \/\/ \u5206\u4eab\u6210\u529f\u540e\u56de\u8c03\r\n\t\t},\r\n\t\tcancel: function () { \/\/ \u5206\u4eab\u5931\u8d25\u540e\u56de\u8c03\r\n\t\t}\r\n\t});\r\n}\r\n<\/pre>\n<p><strong>\u540e\u7aef\u8bf7\u6c42\u6587\u4ef6getSign.php<\/strong><\/p>\n<pre lang=\"PHP\" line=\"1\">\r\nerror_reporting(E_ALL^E_NOTICE^E_WARNING);\r\nclass JSSDK {\r\n\tprivate $appId;\r\n\tprivate $appSecret;\r\n\r\n\tpublic function __construct($appId, $appSecret) {\r\n\t\t$this->appId = $appId;\r\n\t\t$this->appSecret = $appSecret;\r\n\t}\r\n\r\n\tpublic function getSignPackage() {\r\n\t\t$jsapiTicket = $this->getJsApiTicket();\r\n\t\t$url = $_GET['url'];\r\n\t\t$timestamp = time();\r\n\t\t$nonceStr = $this->createNonceStr();\r\n\r\n\t\t\/\/ \u8fd9\u91cc\u53c2\u6570\u7684\u987a\u5e8f\u8981\u6309\u7167 key \u503c ASCII \u7801\u5347\u5e8f\u6392\u5e8f\r\n\t\t$string = \"jsapi_ticket=$jsapiTicket&noncestr=$nonceStr&timestamp=$timestamp&url=$url\";\r\n\t\t$signature = sha1($string);\r\n\t\t$signPackage = array(\r\n\t\t\t\"appId\"     => $this->appId,\r\n\t\t\t\"nonceStr\"  => $nonceStr,\r\n\t\t\t\"timestamp\" => $timestamp,\r\n\t\t\t\"url\"       => $url,\r\n\t\t\t\"signature\" => $signature,\r\n\t\t\t\"rawString\" => $string\r\n\t\t);\r\n\t\treturn $signPackage; \r\n\t}\r\n\r\n\tprivate function createNonceStr($length = 16) {\r\n\t\t$chars = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\";\r\n\t\t$str = \"\";\r\n\t\tfor ($i = 0; $i < $length; $i++) {\r\n\t\t\t$str .= substr($chars, mt_rand(0, strlen($chars) - 1), 1);\r\n\t\t}\r\n\t\treturn $str;\r\n\t}\r\n\r\n\tprivate function getJsApiTicket() {\r\n\t\t\/\/ jsapi_ticket \u5e94\u8be5\u5168\u5c40\u5b58\u50a8\u4e0e\u66f4\u65b0\uff0c\u5982\u65e0\u672c\u5730 jsapi_ticket \u6587\u4ef6\uff0c\u6b64\u5904\u4f1a\u751f\u6210\u4e00\u4e2a\r\n\t\t$data = json_decode(file_get_contents(\"jsapi_ticket.json\"));\r\n\t\tif ($data->expire_time < time()) {\r\n\t\t\t$accessToken = $this->getAccessToken();\r\n\t\t\t$url = \"https:\/\/api.weixin.qq.com\/cgi-bin\/ticket\/getticket?type=jsapi&access_token=$accessToken\";\r\n\t\t\t$res = json_decode($this->httpGet($url));\r\n\t\t\t$ticket = $res->ticket;\r\n\t\t\tif ($ticket) {\r\n\t\t\t\t$data->expire_time = time() + 7000;\r\n\t\t\t\t$data->jsapi_ticket = $ticket;\r\n\t\t\t\t$fp = fopen(\"jsapi_ticket.json\", \"w\");\r\n\t\t\t\tfwrite($fp, json_encode($data));\r\n\t\t\t\tfclose($fp);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t$ticket = $data->jsapi_ticket;\r\n\t\t}\r\n\t\treturn $ticket;\r\n\t}\r\n\r\n\tprivate function getAccessToken() {\r\n\t\t\/\/access_token \u5e94\u8be5\u5168\u5c40\u5b58\u50a8\u4e0e\u66f4\u65b0\uff0c\u5982\u65e0\u672c\u5730access_token \u6587\u4ef6\uff0c\u6b64\u5904\u4f1a\u751f\u6210\u4e00\u4e2a\r\n\t\t$data = json_decode(file_get_contents(\"access_token.json\"));\r\n\t\tif ($data->expire_time < time()) {\r\n\t\t\t$url = \"https:\/\/api.weixin.qq.com\/cgi-bin\/token?grant_type=client_credential&#038;appid=$this->appId&secret=$this->appSecret\";\r\n\t\t\t$res = json_decode($this->httpGet($url));\r\n\t\t\t$access_token = $res->access_token;\r\n\t\t\tif ($access_token) {\r\n\t\t\t\t$data->expire_time = time() + 7000;\r\n\t\t\t\t$data->access_token = $access_token;\r\n\t\t\t\t$fp = fopen(\"access_token.json\", \"w\");\r\n\t\t\t\tfwrite($fp, json_encode($data));\r\n\t\t\t\tfclose($fp);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t$access_token = $data->access_token;\r\n\t\t}\r\n\t\treturn $access_token;\r\n\t}\r\n\r\n\tprivate function httpGet($url) {\r\n\t\t$curl = curl_init();\r\n\t\tcurl_setopt($curl, CURLOPT_RETURNTRANSFER, true);\r\n\t\tcurl_setopt($curl, CURLOPT_TIMEOUT, 500);\r\n\t\tcurl_setopt($curl, CURLOPT_URL, $url);\r\n\t\t$res = curl_exec($curl);\r\n\t\tcurl_close($curl);\r\n\t\treturn $res;\r\n\t}\r\n}\r\n\r\n$jssdk = new JSSDK(\"\u00d7\u00d7\u00d7\u00d7\u00d7\", \"\u00d7\u00d7\u00d7\u00d7\u00d7\u00d7\u00d7\");\/\/\u6b64\u5904\u586b\u5199\u670d\u52a1\u53f7\u7684APPID\u548cAPPSecret\r\n$signPackage = $jssdk->GetSignPackage();\r\necho json_encode($signPackage);\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6709\u5dee\u4e0d\u591a\u4e00\u5e74\u6ca1\u6709\u63a5H5\u7684\u5f00\u53d1\u4e86\uff0c\u6700\u8fd1\u53c8\u63a5\u4e86\u4e00\u4e2a\uff0c\u53d1\u73b0\u4ee5\u524d\u5199\u8fc7\u7684\u5fae\u4fe1\u5206\u4eab\u90e8\u5206\u4e0d\u7ba1\u7528\u4e86\uff0c\u8e29\u5751\uff0c\u53c8\u8e29\u5751\u4e86\uff01 \u9996\u5148\u662f\u670d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33],"tags":[82],"class_list":["post-2685","post","type-post","status-publish","format-standard","hentry","category-front-end-development","tag-82"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>H5\u5fae\u4fe1\u5206\u4eabJS\/\u540e\u7aefPHP\u5b8c\u6574\u7248\u4ee3\u7801 - Brain\u7684\u6280\u672f\u7b14\u8bb0<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.brain1981.com\/2685.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"H5\u5fae\u4fe1\u5206\u4eabJS\/\u540e\u7aefPHP\u5b8c\u6574\u7248\u4ee3\u7801 - Brain\u7684\u6280\u672f\u7b14\u8bb0\" \/>\n<meta property=\"og:description\" content=\"\u6709\u5dee\u4e0d\u591a\u4e00\u5e74\u6ca1\u6709\u63a5H5\u7684\u5f00\u53d1\u4e86\uff0c\u6700\u8fd1\u53c8\u63a5\u4e86\u4e00\u4e2a\uff0c\u53d1\u73b0\u4ee5\u524d\u5199\u8fc7\u7684\u5fae\u4fe1\u5206\u4eab\u90e8\u5206\u4e0d\u7ba1\u7528\u4e86\uff0c\u8e29\u5751\uff0c\u53c8\u8e29\u5751\u4e86\uff01 \u9996\u5148\u662f\u670d [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.brain1981.com\/2685.html\" \/>\n<meta property=\"og:site_name\" content=\"Brain\u7684\u6280\u672f\u7b14\u8bb0\" \/>\n<meta property=\"article:published_time\" content=\"2022-01-24T19:57:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-01-24T20:05:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/blog.brain1981.com\/wp-content\/uploads\/2022\/01\/ipwhitelist.jpg\" \/>\n<meta name=\"author\" content=\"Brain\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"Brain\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/blog.brain1981.com\\\/2685.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.brain1981.com\\\/2685.html\"},\"author\":{\"name\":\"Brain\",\"@id\":\"https:\\\/\\\/blog.brain1981.com\\\/#\\\/schema\\\/person\\\/7689202bbb2f967b4c66309c1cc5e65d\"},\"headline\":\"H5\u5fae\u4fe1\u5206\u4eabJS\\\/\u540e\u7aefPHP\u5b8c\u6574\u7248\u4ee3\u7801\",\"datePublished\":\"2022-01-24T19:57:00+00:00\",\"dateModified\":\"2022-01-24T20:05:17+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/blog.brain1981.com\\\/2685.html\"},\"wordCount\":43,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/blog.brain1981.com\\\/#\\\/schema\\\/person\\\/7689202bbb2f967b4c66309c1cc5e65d\"},\"image\":{\"@id\":\"https:\\\/\\\/blog.brain1981.com\\\/2685.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/blog.brain1981.com\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/ipwhitelist.jpg\",\"keywords\":[\"\u5fae\u4fe1\"],\"articleSection\":[\"\u524d\u7aef\u5f00\u53d1\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/blog.brain1981.com\\\/2685.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/blog.brain1981.com\\\/2685.html\",\"url\":\"https:\\\/\\\/blog.brain1981.com\\\/2685.html\",\"name\":\"H5\u5fae\u4fe1\u5206\u4eabJS\\\/\u540e\u7aefPHP\u5b8c\u6574\u7248\u4ee3\u7801 - Brain\u7684\u6280\u672f\u7b14\u8bb0\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.brain1981.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/blog.brain1981.com\\\/2685.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/blog.brain1981.com\\\/2685.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/blog.brain1981.com\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/ipwhitelist.jpg\",\"datePublished\":\"2022-01-24T19:57:00+00:00\",\"dateModified\":\"2022-01-24T20:05:17+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/blog.brain1981.com\\\/2685.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/blog.brain1981.com\\\/2685.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\\\/\\\/blog.brain1981.com\\\/2685.html#primaryimage\",\"url\":\"https:\\\/\\\/blog.brain1981.com\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/ipwhitelist.jpg\",\"contentUrl\":\"https:\\\/\\\/blog.brain1981.com\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/ipwhitelist.jpg\",\"width\":1141,\"height\":584},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/blog.brain1981.com\\\/2685.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\\\/\\\/blog.brain1981.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"H5\u5fae\u4fe1\u5206\u4eabJS\\\/\u540e\u7aefPHP\u5b8c\u6574\u7248\u4ee3\u7801\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/blog.brain1981.com\\\/#website\",\"url\":\"https:\\\/\\\/blog.brain1981.com\\\/\",\"name\":\"Brain\u7684\u6280\u672f\u7b14\u8bb0\",\"description\":\"WordPress\u5efa\u7ad9\u5f00\u53d1\u6559\u7a0b\u4e0e\u6280\u672f\u7814\u7a76\",\"publisher\":{\"@id\":\"https:\\\/\\\/blog.brain1981.com\\\/#\\\/schema\\\/person\\\/7689202bbb2f967b4c66309c1cc5e65d\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/blog.brain1981.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/blog.brain1981.com\\\/#\\\/schema\\\/person\\\/7689202bbb2f967b4c66309c1cc5e65d\",\"name\":\"Brain\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\\\/\\\/blog.brain1981.com\\\/wp-content\\\/uploads\\\/2026\\\/01\\\/favicon.webp\",\"url\":\"https:\\\/\\\/blog.brain1981.com\\\/wp-content\\\/uploads\\\/2026\\\/01\\\/favicon.webp\",\"contentUrl\":\"https:\\\/\\\/blog.brain1981.com\\\/wp-content\\\/uploads\\\/2026\\\/01\\\/favicon.webp\",\"width\":75,\"height\":75,\"caption\":\"Brain\"},\"logo\":{\"@id\":\"https:\\\/\\\/blog.brain1981.com\\\/wp-content\\\/uploads\\\/2026\\\/01\\\/favicon.webp\"},\"sameAs\":[\"http:\\\/\\\/brain1981.com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"H5\u5fae\u4fe1\u5206\u4eabJS\/\u540e\u7aefPHP\u5b8c\u6574\u7248\u4ee3\u7801 - Brain\u7684\u6280\u672f\u7b14\u8bb0","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.brain1981.com\/2685.html","og_locale":"zh_CN","og_type":"article","og_title":"H5\u5fae\u4fe1\u5206\u4eabJS\/\u540e\u7aefPHP\u5b8c\u6574\u7248\u4ee3\u7801 - Brain\u7684\u6280\u672f\u7b14\u8bb0","og_description":"\u6709\u5dee\u4e0d\u591a\u4e00\u5e74\u6ca1\u6709\u63a5H5\u7684\u5f00\u53d1\u4e86\uff0c\u6700\u8fd1\u53c8\u63a5\u4e86\u4e00\u4e2a\uff0c\u53d1\u73b0\u4ee5\u524d\u5199\u8fc7\u7684\u5fae\u4fe1\u5206\u4eab\u90e8\u5206\u4e0d\u7ba1\u7528\u4e86\uff0c\u8e29\u5751\uff0c\u53c8\u8e29\u5751\u4e86\uff01 \u9996\u5148\u662f\u670d [&hellip;]","og_url":"https:\/\/blog.brain1981.com\/2685.html","og_site_name":"Brain\u7684\u6280\u672f\u7b14\u8bb0","article_published_time":"2022-01-24T19:57:00+00:00","article_modified_time":"2022-01-24T20:05:17+00:00","og_image":[{"url":"https:\/\/blog.brain1981.com\/wp-content\/uploads\/2022\/01\/ipwhitelist.jpg","type":"","width":"","height":""}],"author":"Brain","twitter_misc":{"\u4f5c\u8005":"Brain","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.brain1981.com\/2685.html#article","isPartOf":{"@id":"https:\/\/blog.brain1981.com\/2685.html"},"author":{"name":"Brain","@id":"https:\/\/blog.brain1981.com\/#\/schema\/person\/7689202bbb2f967b4c66309c1cc5e65d"},"headline":"H5\u5fae\u4fe1\u5206\u4eabJS\/\u540e\u7aefPHP\u5b8c\u6574\u7248\u4ee3\u7801","datePublished":"2022-01-24T19:57:00+00:00","dateModified":"2022-01-24T20:05:17+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.brain1981.com\/2685.html"},"wordCount":43,"commentCount":0,"publisher":{"@id":"https:\/\/blog.brain1981.com\/#\/schema\/person\/7689202bbb2f967b4c66309c1cc5e65d"},"image":{"@id":"https:\/\/blog.brain1981.com\/2685.html#primaryimage"},"thumbnailUrl":"https:\/\/blog.brain1981.com\/wp-content\/uploads\/2022\/01\/ipwhitelist.jpg","keywords":["\u5fae\u4fe1"],"articleSection":["\u524d\u7aef\u5f00\u53d1"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/blog.brain1981.com\/2685.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/blog.brain1981.com\/2685.html","url":"https:\/\/blog.brain1981.com\/2685.html","name":"H5\u5fae\u4fe1\u5206\u4eabJS\/\u540e\u7aefPHP\u5b8c\u6574\u7248\u4ee3\u7801 - Brain\u7684\u6280\u672f\u7b14\u8bb0","isPartOf":{"@id":"https:\/\/blog.brain1981.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blog.brain1981.com\/2685.html#primaryimage"},"image":{"@id":"https:\/\/blog.brain1981.com\/2685.html#primaryimage"},"thumbnailUrl":"https:\/\/blog.brain1981.com\/wp-content\/uploads\/2022\/01\/ipwhitelist.jpg","datePublished":"2022-01-24T19:57:00+00:00","dateModified":"2022-01-24T20:05:17+00:00","breadcrumb":{"@id":"https:\/\/blog.brain1981.com\/2685.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.brain1981.com\/2685.html"]}]},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/blog.brain1981.com\/2685.html#primaryimage","url":"https:\/\/blog.brain1981.com\/wp-content\/uploads\/2022\/01\/ipwhitelist.jpg","contentUrl":"https:\/\/blog.brain1981.com\/wp-content\/uploads\/2022\/01\/ipwhitelist.jpg","width":1141,"height":584},{"@type":"BreadcrumbList","@id":"https:\/\/blog.brain1981.com\/2685.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/blog.brain1981.com\/"},{"@type":"ListItem","position":2,"name":"H5\u5fae\u4fe1\u5206\u4eabJS\/\u540e\u7aefPHP\u5b8c\u6574\u7248\u4ee3\u7801"}]},{"@type":"WebSite","@id":"https:\/\/blog.brain1981.com\/#website","url":"https:\/\/blog.brain1981.com\/","name":"Brain\u7684\u6280\u672f\u7b14\u8bb0","description":"WordPress\u5efa\u7ad9\u5f00\u53d1\u6559\u7a0b\u4e0e\u6280\u672f\u7814\u7a76","publisher":{"@id":"https:\/\/blog.brain1981.com\/#\/schema\/person\/7689202bbb2f967b4c66309c1cc5e65d"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.brain1981.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/blog.brain1981.com\/#\/schema\/person\/7689202bbb2f967b4c66309c1cc5e65d","name":"Brain","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/blog.brain1981.com\/wp-content\/uploads\/2026\/01\/favicon.webp","url":"https:\/\/blog.brain1981.com\/wp-content\/uploads\/2026\/01\/favicon.webp","contentUrl":"https:\/\/blog.brain1981.com\/wp-content\/uploads\/2026\/01\/favicon.webp","width":75,"height":75,"caption":"Brain"},"logo":{"@id":"https:\/\/blog.brain1981.com\/wp-content\/uploads\/2026\/01\/favicon.webp"},"sameAs":["http:\/\/brain1981.com"]}]}},"views":3687,"_links":{"self":[{"href":"https:\/\/blog.brain1981.com\/wp-json\/wp\/v2\/posts\/2685","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.brain1981.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.brain1981.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.brain1981.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.brain1981.com\/wp-json\/wp\/v2\/comments?post=2685"}],"version-history":[{"count":5,"href":"https:\/\/blog.brain1981.com\/wp-json\/wp\/v2\/posts\/2685\/revisions"}],"predecessor-version":[{"id":2692,"href":"https:\/\/blog.brain1981.com\/wp-json\/wp\/v2\/posts\/2685\/revisions\/2692"}],"wp:attachment":[{"href":"https:\/\/blog.brain1981.com\/wp-json\/wp\/v2\/media?parent=2685"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.brain1981.com\/wp-json\/wp\/v2\/categories?post=2685"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.brain1981.com\/wp-json\/wp\/v2\/tags?post=2685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}