{"id":96,"date":"2021-07-30T16:56:28","date_gmt":"2021-07-30T08:56:28","guid":{"rendered":"http:\/\/blog.nonot.cn\/?p=96"},"modified":"2024-07-08T12:54:20","modified_gmt":"2024-07-08T04:54:20","slug":"%e3%80%90php%e3%80%91php%e5%ae%9e%e7%8e%b0%e5%be%ae%e4%bf%a1%e6%94%af%e4%bb%98jsapi%e6%94%af%e4%bb%98%e6%b5%81%e7%a8%8b%e6%ad%a5%e9%aa%a4%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/blog.nonot.cn\/index.php\/2021\/07\/30\/%e3%80%90php%e3%80%91php%e5%ae%9e%e7%8e%b0%e5%be%ae%e4%bf%a1%e6%94%af%e4%bb%98jsapi%e6%94%af%e4%bb%98%e6%b5%81%e7%a8%8b%e6%ad%a5%e9%aa%a4%e8%af%a6%e8%a7%a3\/","title":{"rendered":"\u3010PHP\u3011PHP\u5b9e\u73b0\u5fae\u4fe1\u652f\u4ed8(jsapi\u652f\u4ed8)\u6d41\u7a0b\u6b65\u9aa4\u8be6\u89e3\uff08\u91c7\u7528\u5b98\u7f51SDK\uff09"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>\u524d\u671f\u51c6\u5907\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1.\u5fae\u4fe1\u8ba4\u8bc1\u670d\u52a1\u53f7\uff0c\u5e76\u4e14\u5f00\u901a\u4e86\u5fae\u4fe1\u652f\u4ed8<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2.\u5fae\u4fe1\u652f\u4ed8SDK\uff0c\u4e0b\u8f7d\u5730\u5740\uff1a<a href=\"https:\/\/pay.weixin.qq.com\/wiki\/doc\/api\/jsapi.php?chapter=11_1\">https:\/\/pay.weixin.qq.com\/wiki\/doc\/api\/jsapi.php?chapter=11_1<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3.\u767b\u5f55\u5fae\u4fe1\u652f\u4ed8\u5e73\u53f0<a href=\"https:\/\/pay.weixin.qq.com\/index.php\/account\/api_cert\">https:\/\/pay.weixin.qq.com\/index.php\/account\/api_cert<\/a>\u4e0b\u8f7d\u652f\u4ed8\u8bc1\u4e66<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u65b9\u6cd5\u6b65\u9aa4\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1.demo\u6587\u4ef6\u5904\u7406<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uff081\uff09\u5c06\u5b98\u65b9\u7684demo\u4e0b\u8f7d\u4e0b\u6765\uff0c\u6587\u4ef6\u540d\u4e3aWxpayAPI_php_v3\uff0c\u628a\u8fd9\u6587\u4ef6\u91cd\u547d\u540d\u4e3awxpay\uff0c\u4e3a\u4e86\u540e\u8fb9\u4e66\u5199\u76ee\u5f55\u65b9\u4fbf\uff1b<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uff082\uff09\u6253\u5f00lib\u6587\u4ef6\u5939\u4e0b\u7684WxPay.Api.php\u6587\u4ef6\uff0c\u5728537\u884c\u6709\u4e00\u6bb5curl\u7f51\u7edc\u8bf7\u6c42\u914d\u7f6e\u4ee3\u7801\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,TRUE); \ncurl_setopt($ch,CURLOPT_SSL_VERIFYHOST,2);\/\/\u4e25\u683c\u6821\u9a8c <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u66ff\u6362\u6210\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE); \ncurl_setopt($ch,CURLOPT_SSL_VERIFYHOST,2);\/\/\u4e25\u683c\u6821\u9a8c<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e3a\u4e86\u7981\u6b62 cURL \u9a8c\u8bc1\u5bf9\u7b49\u8bc1\u4e66\uff08peer&#8217;s certificate\uff09\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uff083\uff09\u6253\u5f00lib\u6587\u4ef6\u5939\u4e0b\u7684WxPay.Config.php\u6587\u4ef6\uff0c\u7b2c25\u884c\u5f00\u59cb\uff0c\u6839\u636e\u81ea\u5df1\u7684\u8d26\u53f7\u5b8c\u6210\u57fa\u672c\u4fe1\u606f\u8bbe\u7f6e\uff1b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const APPID = '\u516c\u4f17\u8d26\u53f7APPID'; \nconst MCHID = '\u5546\u6237\u53f7'; \nconst KEY = '\u5546\u6237\u652f\u4ed8\u5bc6\u94a5'; \nconst APPSECRET = '\u516c\u4f17\u5e10\u53f7secert'; <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\uff084\uff09\u6253\u5f00lib\u6587\u4ef6\u5939\u4e0b\u7684WxPay.Notify.php\u6587\u4ef6\uff0c\u7b2c79\u884c\u7684\u4ee3\u7801\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if($needSign == true &amp;&amp; \n $this->GetReturn_code($return_code) == \"SUCCESS\") \n{ \n $this->SetSign(); \n} <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u6539\u6210\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if($needSign == true &amp;&amp; \n $this->GetReturn_code() == \"SUCCESS\") \n{ \n $this->SetSign(); \n} <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\uff085\uff09\u6253\u5f00cert\u8bc1\u4e66\u76ee\u5f55\uff0c\u5c06\u91cc\u8fb9\u7684\u4e24\u4e2a\u8bc1\u4e66\u6362\u6210\u81ea\u5df1\u7684\u652f\u4ed8\u8bc1\u4e66\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2.\u516c\u4f17\u53f7\u540e\u53f0\u8bbe\u7f6e<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uff081\uff09\u914d\u7f6e\u7f51\u9875\u6388\u6743\u57df\u540d\uff0c\u6211\u7684\u57df\u540d\u662f\uff08xy.chuyin.ren\uff09\uff1b<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"\/wp-content\/uploads\/replace\/aebbf41fd4b5711f4ebfb3a65ab293e4.jpeg\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\uff081\uff09\u914d\u7f6e\u652f\u4ed8\u6388\u6743\u76ee\u5f55\uff0c\u57df\u540d\u662f\uff08xy.chuyin.ren\uff09\uff0c\u6211\u5c06demo\u653e\u5230\u6b64\u57df\u540d\u6307\u5411\u7684\u76ee\u5f55\u7684weixinopen\/\u6587\u4ef6\u5939\u4e0b\uff0cdemo\u4e2djsapi.php\u6587\u4ef6\u4f4d\u4e8eexample\/\u76ee\u5f55\u4e0b\uff0c\u6240\u4ee5\u652f\u4ed8\u6388\u6743\u76ee\u5f55\u4e3a\uff1axy.chuyin.ren\/weixinopen\/wxpay\/example\/<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.nonot.cn\/wp-content\/uploads\/2021\/08\/89203-201803150920244.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">3.\u652f\u4ed8\u6d41\u7a0b<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6253\u5f00example\u76ee\u5f55\u4e0b\u7684jsapi.php\u6587\u4ef6\uff0c\u652f\u4ed8\u53d1\u8d77\u548c\u5904\u7406\uff0c\u90fd\u662f\u5728\u8fd9\u91cc\u5b8c\u6210\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uff081\uff09\u83b7\u53d6\u7528\u6237openid<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e4b\u524d\u914d\u7f6e\u597d\u4e86\u81ea\u5df1\u7684APPID\u548cAPPSecert\uff0c\u6240\u4ee5\u8fd9\u91cc\u4e0d\u7528\u5904\u7406\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/\u2460\u3001\u83b7\u53d6\u7528\u6237openid \n$tools = new JsApiPay(); \n$openId = $tools->GetOpenid(); <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u91cc\u9996\u5148\u521d\u59cb\u5316\u7684\u4e00\u4e2aJsApiPay()\u7c7b\u5f97\u5230\u4e00\u4e2a\u5bf9\u8c61\uff0c\u6587\u4ef6\u5bf9\u5e94example\/\u76ee\u5f55\u4e0b\u7684WxPay.JsApiPay.php\uff0c\u8c03\u7528GetOpenid()\u65b9\u6cd5\uff0c\u4f1a\u81ea\u52a8\u83b7\u53d6\u81ea\u5df1\u7684openID\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uff082\uff09\u7edf\u4e00\u4e0b\u5355<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/\u2461\u3001\u7edf\u4e00\u4e0b\u5355 \n$input = new WxPayUnifiedOrder(); \n$input->SetBody(\"test\"); \n$input->SetAttach(\"test\"); \n$input->SetOut_trade_no(WxPayConfig::MCHID.date(\"YmdHis\")); \n$input->SetTotal_fee(\"1\"); \n$input->SetTime_start(date(\"YmdHis\")); \n$input->SetTime_expire(date(\"YmdHis\", time() + 600)); \n$input->SetGoods_tag(\"test\"); \n$input->SetNotify_url(\"http:\/\/paysdk.weixin.qq.com\/example\/notify.php\"); \n$input->SetTrade_type(\"JSAPI\"); \n$input->SetOpenid($openId); \n$order = WxPayApi::unifiedOrder($input); \necho '&lt;font color=\"#f00\">&lt;b>\u7edf\u4e00\u4e0b\u5355\u652f\u4ed8\u5355\u4fe1\u606f&lt;\/b>&lt;\/font>&lt;br\/>'; \nprintf_info($order); \n$jsApiParameters = $tools->GetJsApiParameters($order); <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5bf9\u5e94WxPay.Api.php\u7684\u7b2c24\u884c\u7684unifiedOrder()\u65b9\u6cd5\uff0c\u914d\u7f6e\u8ba2\u5355\u4fe1\u606f\u548c\u652f\u4ed8\u56de\u8c03\u51fd\u6570\uff0c\u8fd9\u91cc\u9700\u8981\u4fee\u6539\u51e0\u4e2a\u53c2\u6570\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A. \u5546\u54c1\u540d\u79f0:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$input->SetBody(\"test\"); <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">B. \u8ba2\u5355\u53f7<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$input->SetOut_trade_no(WxPayConfig::MCHID.date(\"YmdHis\")); <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">C. \u652f\u4ed8\u91d1\u989d<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$input->SetTotal_fee(\"1\");<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">D. \u652f\u4ed8\u9a8c\u8bc1\u94fe\u63a5<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8bbe\u7f6e\u4e3a\u4f60\u7684notify.php\u6587\u4ef6\u6240\u5728\u7684\u4f4d\u7f6e\uff0c\u6240\u4ee5\u6211\u8fd9\u91cc\u8bbe\u7f6e\u4e3a\uff1a<a href=\"http:\/\/xy.chuyin.ren\/weixinopen\/wxpay\/example\/notify.php\">http:\/\/xy.chuyin.ren\/weixinopen\/wxpay\/example\/notify.php<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e5f\u53ef\u4ee5\u5199\u5176\u4ed6\u5730\u5740,\u5f53\u7136\u8981\u5728\u652f\u4ed8\u6388\u6743\u57df\u540d\u4e4b\u4e0b,\u652f\u4ed8\u6210\u529f\u4e4b\u540e\u5c31\u4f1a\u81ea\u52a8\u56de\u8c03\u5230\u8be5\u94fe\u63a5\u6307\u5b9a\u7684\u65b9\u6cd5\u91cc\u8fb9,\u53ef\u4ee5\u5728\u91cc\u8fb9\u8fdb\u884c\u5224\u65ad\u548c\u6570\u636e\u5e93\u64cd\u4f5c.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$input->SetNotify_url(&lt;a rel=\"external nofollow\" href=\"http:\/\/paysdk.weixin.qq.com\/example\/notify.php\">http:\/\/paysdk.weixin.qq.com\/example\/notify.php&lt;\/a>);\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">E. \u9644\u52a0\u53c2\u6570<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$input->SetAttach(\"test\"); <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u9644\u52a0\u53c2\u6570,\u53ef\u586b\u53ef\u4e0d\u586b,\u586b\u5199\u7684\u8bdd,\u91cc\u8fb9\u5b57\u7b26\u4e32\u6700\u597d\u4e0d\u8981\u51fa\u73b0\u7a7a\u683c\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u65f6\u5019\uff0c\u70b9\u51fb\u652f\u4ed8\u5e94\u8be5\u5c31\u53ef\u4ee5\u6210\u529f\u652f\u4ed8\u4e86\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uff083\uff09\u53d1\u8d77\u652f\u4ed8<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;script type=\"text\/javascript\"> \n\/\/\u8c03\u7528\u5fae\u4fe1JS api \u652f\u4ed8 \nfunction jsApiCall() \n{ \n WeixinJSBridge.invoke( \n  'getBrandWCPayRequest', \n  &lt;?php echo $jsApiParameters; ?>, \n  function(res){ \n   WeixinJSBridge.log(res.err_msg); \n   alert(res.err_code+res.err_desc+res.err_msg); \n  } \n ); \n} \nfunction callpay() \n{ \n if (typeof WeixinJSBridge == \"undefined\"){ \n  if( document.addEventListener ){ \n   document.addEventListener('WeixinJSBridgeReady', jsApiCall, false); \n  }else if (document.attachEvent){ \n   document.attachEvent('WeixinJSBridgeReady', jsApiCall); \n   document.attachEvent('onWeixinJSBridgeReady', jsApiCall); \n  } \n }else{ \n  jsApiCall(); \n } \n} \n&lt;\/script> <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u70b9\u51fb\u7acb\u5373\u652f\u4ed8\u6309\u94ae\u8c03\u7528\u7684\u5c31\u662f callpay() \u51fd\u6570\uff0c\u4ed6\u6709\u4f1a\u8c03\u7528jsApiCall() \u51fd\u6570\u6253\u5f00\u652f\u4ed8\u7a0b\u5e8f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.nonot.cn\/wp-content\/uploads\/2021\/08\/35f4f-201803150920245.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">jsApiCall() \u51fd\u6570\u4f1a\u76d1\u542c\u6bcf\u4e00\u6b65\u52a8\u4f5c:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.nonot.cn\/wp-content\/uploads\/2021\/08\/79113-201803150920246.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><code>&nbsp;res.err_msg \u4e3aget_brand_wcpay_request:cancel&nbsp;<\/code>\u8868\u660e\u524d\u7aef\u5224\u65ad\u7684\u53d6\u6d88\u652f\u4ed8\uff0ces.err_msg \u4e3aget_brand_wcpay_request:ok \u8868\u660e\u524d\u7aef\u5224\u65ad\u7684\u652f\u4ed8\u6210\u529f\uff0c\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u8fd9\u4e2a\u5c06\u652f\u4ed8\u8df3\u8f6c\u5230\u6210\u529f\u9875\u9762\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uff084\uff09\u652f\u6301\u6210\u529f\u56de\u8c03<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u901a\u8fc7\u524d\u7aefjsApiCall()\u51fd\u6570\u53ef\u4ee5\u76d1\u542c\u652f\u4ed8\u7ed3\u679c\uff0c\u4f46\u662f\u8fd9\u4e2a\u5e76\u4e0d\u53ef\u4fe1\u3002\u786e\u8ba4\u662f\u5426\u652f\u4ed8\u6210\u529f\u8fd8\u662f\u5e94\u5f53\u901a\u8fc7notify.php \u5904\u7406\u4e1a\u52a1\u903b\u8f91\u3002\u524d\u8fb9\u914d\u7f6e\u597d\u4e86\u652f\u4ed8\u9a8c\u8bc1\u94fe\u63a5SetNotify_url()\uff0c\u652f\u4ed8\u5b8c\u6210\u540e,\u5fae\u4fe1\u670d\u52a1\u5668\u4f1a\u6839\u636e\u94fe\u63a5\u81ea\u52a8\u8bf7\u6c42\u4f60\u7684notify.php\u6587\u4ef6\uff0c\u6253\u5f00\u8fd9\u4e2a\u6587\u4ef6\uff0c\u5176\u5b9e\u8fd9\u4e2a\u6587\u4ef6\u6700\u4e3b\u8981\u7684\u4ee3\u7801\u5c31\u4e24\u884c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$notify = new PayNotifyCallBack(); \n$notify->Handle(false); <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u7531\u6b64\u8ddf\u8e2a\u5230WxPay.Notify.php\u7c7b\u6587\u4ef6\u7684Handle()\u51fd\u6570\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/** \n * \n * \u56de\u8c03\u5165\u53e3 \n * @param bool $needSign \u662f\u5426\u9700\u8981\u7b7e\u540d\u8f93\u51fa \n *\/ \nfinal public function Handle($needSign = true) \n{ \n $msg = \"OK\"; \n \/\/\u5f53\u8fd4\u56defalse\u7684\u65f6\u5019\uff0c\u8868\u793anotify\u4e2d\u8c03\u7528NotifyCallBack\u56de\u8c03\u5931\u8d25\u83b7\u53d6\u7b7e\u540d\u6821\u9a8c\u5931\u8d25\uff0c\u6b64\u65f6\u76f4\u63a5\u56de\u590d\u5931\u8d25 \n $result = WxpayApi::notify(array($this, 'NotifyCallBack'), $msg); \n if($result == false){ \n  $this->SetReturn_code(\"FAIL\"); \n  $this->SetReturn_msg($msg); \n  $this->ReplyNotify(false); \n  return; \n } else { \n  \/\/\u8be5\u5206\u652f\u5728\u6210\u529f\u56de\u8c03\u5230NotifyCallBack\u65b9\u6cd5\uff0c\u5904\u7406\u5b8c\u6210\u4e4b\u540e\u6d41\u7a0b \n  $this->SetReturn_code(\"SUCCESS\"); \n  $this->SetReturn_msg(\"OK\"); \n } \n $this->ReplyNotify($needSign); \n} <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e3b\u8981\u4ee3\u7801\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$result = WxpayApi::notify(array($this, 'NotifyCallBack'), $msg); <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u7136\u540e\u6765\u5230WxPay.Api.php\u6587\u4ef6\u7684\u7b2c411\u884c\uff0cnotify()\u51fd\u6570\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/** \n * \n * \u652f\u4ed8\u7ed3\u679c\u901a\u7528\u901a\u77e5 \n * @param function $callback \n * \u76f4\u63a5\u56de\u8c03\u51fd\u6570\u4f7f\u7528\u65b9\u6cd5: notify(you_function); \n * \u56de\u8c03\u7c7b\u6210\u5458\u51fd\u6570\u65b9\u6cd5:notify(array($this, you_function)); \n * $callback \u539f\u578b\u4e3a\uff1afunction function_name($data){} \n *\/ \npublic static function notify($callback, &amp;$msg) \n{ \n \/\/\u83b7\u53d6\u901a\u77e5\u7684\u6570\u636e \n $xml = $GLOBALS['HTTP_RAW_POST_DATA']; \n \/\/file_put_contents('log.txt',$xml,FILE_APPEND); \n \/\/\u5982\u679c\u8fd4\u56de\u6210\u529f\u5219\u9a8c\u8bc1\u7b7e\u540d \n try { \n  $result = WxPayResults::Init($xml); \n } catch (WxPayException $e){ \n  $msg = $e->errorMessage(); \n  return false; \n } \n  \n return call_user_func($callback, $result); \n} <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u91cc\u9762\u7684$xml=$GLOBALS[&#8216;HTTP_RAW_POST_DATA&#8217;]\uff0c\u5c31\u662f\u652f\u4ed8\u6210\u529f\u540e\u7528\u6237\u8fd4\u56de\u7ed9\u4f60\u7684\u4e00\u4e2a\u7ed3\u679c\uff0c\u4ed6\u662f\u4e00\u4e2axml\u683c\u5f0f\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.nonot.cn\/wp-content\/uploads\/2021\/08\/d3233-201803150920247.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u4eec\u53ef\u4ee5\u5c06\u8fd9\u91cc\u8fd4\u56de\u7684xml\u6570\u636e\u8bb0\u5f55\u4e0b\u6765\uff0c\u7136\u540e\u6253\u5f00\u770b\u770b$out_trade_no\u5c31\u662f\u5728\u652f\u4ed8\u4e4b\u524d\u6211\u81ea\u5df1\u8bbe\u7f6e\u7684\u8ba2\u5355\u53f7\u7801\uff0c$attach\u5c31\u662f\u8bbe\u7f6e\u7684\u9644\u52a0\u53c2\u6570\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f97\u5230\u4e86\u8fd9\u4e2a\u8ba2\u5355\u53f7\uff0c\u7136\u540e\u6211\u5c31\u76f4\u63a5\u5728\u4e0b\u9762\u5199\u652f\u4ed8\u6210\u529f\u540e\u7684\u903b\u8f91\u4e86\uff0c\u6bd4\u5982\u6539\u53d8\u6570\u636e\u5e93\u4e2d\u7684\u6570\u636e\u7b49\u7b49\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u6837 \u5fae\u4fe1\u652f\u4ed8\u7684 JsApi\u652f\u4ed8\u5c31\u5927\u81f4\u5206\u6790\u5b8c\u6210\u4e86\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.nonot.cn\/wp-content\/uploads\/2021\/08\/8690f-201803150920248.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u662f\u96c6\u6210\u4e86\u5b98\u65b9\u7684SDK\u5b9e\u73b0\u7684<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u603b\u7ed3<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee5\u4e0a\u6240\u8ff0\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u7684PHP\u5b9e\u73b0\u5fae\u4fe1\u652f\u4ed8(jsapi\u652f\u4ed8)\u6d41\u7a0b\u6b65\u9aa4\u8be6\u89e3\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u671f\u51c6\u5907\uff1a 1.\u5fae\u4fe1\u8ba4\u8bc1\u670d\u52a1\u53f7\uff0c\u5e76\u4e14\u5f00\u901a\u4e86\u5fae\u4fe1\u652f\u4ed8 2.\u5fae\u4fe1&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-96","post","type-post","status-publish","format-standard","hentry","category-php"],"_links":{"self":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts\/96","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/comments?post=96"}],"version-history":[{"count":1,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts\/96\/revisions"}],"predecessor-version":[{"id":1219,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts\/96\/revisions\/1219"}],"wp:attachment":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/media?parent=96"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/categories?post=96"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/tags?post=96"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}