{"id":4073,"date":"2024-11-10T15:51:28","date_gmt":"2024-11-10T07:51:28","guid":{"rendered":"https:\/\/fwq.ai\/blog\/4073\/"},"modified":"2024-11-10T15:51:28","modified_gmt":"2024-11-10T07:51:28","slug":"%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8-laravel-%e6%a1%86%e6%9e%b6%e8%bd%bb%e6%9d%be%e5%b0%81%e8%a3%85%e5%be%ae%e4%bf%a1%e6%94%af%e4%bb%98%e5%92%8c%e6%94%af%e4%bb%98%e5%ae%9d%e6%94%af%e4%bb%98%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/4073\/","title":{"rendered":"\u5982\u4f55\u4f7f\u7528 Laravel \u6846\u67b6\u8f7b\u677e\u5c01\u88c5\u5fae\u4fe1\u652f\u4ed8\u548c\u652f\u4ed8\u5b9d\u652f\u4ed8\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173122094227048.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u4f7f\u7528 Laravel \u6846\u67b6\u8f7b\u677e\u5c01\u88c5\u5fae\u4fe1\u652f\u4ed8\u548c\u652f\u4ed8\u5b9d\u652f\u4ed8\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u4f7f\u7528 Laravel \u6846\u67b6\u8f7b\u677e\u5c01\u88c5\u5fae\u4fe1\u652f\u4ed8\u548c\u652f\u4ed8\u5b9d\u652f\u4ed8\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong> \u6846\u67b6\u4e2d\u652f\u4ed8\u548c\u652f\u4ed8\u5c01\u88c5\u65b9\u6848<\/strong><\/p>\n<p>\u5c01\u88c5\u7b2c\u4e09\u65b9\u652f\u4ed8\u63a5\u53e3\u662f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u5e38\u89c1\u9700\u6c42\uff0c\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528 Laravel \u6846\u67b6\u5c01\u88c5\u548c\u652f\u4ed8\u5b9d\u652f\u4ed8\u3002<\/p>\n<p>\u73b0\u6709\u7684\u7b2c\u4e09\u65b9\u652f\u4ed8\u5c01\u88c5\u5e93\u7e41\u591a\uff0c\u5efa\u8bae\u76f4\u63a5\u91c7\u7528\u6210\u719f\u4e14\u7a33\u5b9a\u7684\u5e93\u3002\u5176\u4e2d\uff0cEasyWeChat \u662f\u4e00\u4e2a\u6d3b\u8dc3\u7ef4\u62a4\u591a\u5e74\u7684\u5e93\uff0c\u7531\u539f\u817e\u8baf\u5458\u5de5\u5f00\u53d1\u3002<\/p>\n<p><strong>EasyWeChat\uff08Laravel \u7248\uff09<\/strong><\/p>\n<p>\u8fd9\u662f\u4e00\u4e2a\u4e13\u95e8\u9002\u7528\u4e8e Laravel \u6846\u67b6\u7684 EasyWeChat \u6269\u5c55\u5305\u3002\u5176\u7279\u70b9\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li>\u63d0\u4f9b\u5fae\u4fe1\u652f\u4ed8\u548c\u652f\u4ed8\u5b9d\u652f\u4ed8\u7684\u5b8c\u6574 API \u5b9e\u73b0\u3002<\/li>\n<li>\u652f\u6301\u5404\u79cd\u652f\u4ed8\u573a\u666f\uff0c\u5305\u62ec\u516c\u4f17\u53f7\u652f\u4ed8\u3001\u5c0f\u7a0b\u5e8f\u652f\u4ed8\u3001H5 \u652f\u4ed8\u7b49\u3002<\/li>\n<li>\u63d0\u4f9b\u4e30\u5bcc\u7684\u6587\u6863\u548c\u793a\u4f8b\uff0c\u6613\u4e8e\u4e0a\u624b\u3002<\/li>\n<\/ul>\n<p><strong>\u5b89\u88c5\u548c\u4f7f\u7528<\/strong><\/p>\n<pre>composer require overtrue\/laravel-wechat<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<pre>\/\/ config\/wechat.php\n'defaults' =&gt; [\n    'log'      =&gt; [\n        'file' =&gt; storage_path('logs\/wechat.log'),\n        'level' =&gt; 'debug',\n    ],\n],<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<pre>use OvertrueLaravelWeChatFacade as WeChat;\n\n$wechat = WeChat::officialAccount();\n$payment = $wechat-&gt;payment();\n$result = $payment-&gt;order-&gt;unify([\n    'body' =&gt; '\u5546\u54c1\u63cf\u8ff0',\n    'out_trade_no' =&gt; '\u8ba2\u5355\u53f7',\n    'total_fee' =&gt; '\u8ba2\u5355\u91d1\u989d',\n]);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u901a\u8fc7\u4ee5\u4e0a\u65b9\u6cd5\uff0c\u5373\u53ef\u8f7b\u677e\u5c01\u88c5\u5fae\u4fe1\u652f\u4ed8\u548c\u652f\u4ed8\u5b9d\u652f\u4ed8\u63a5\u53e3\uff0c\u6ee1\u8db3\u5404\u79cd\u652f\u4ed8\u573a\u666f\u7684\u9700\u6c42\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u4f7f\u7528 Laravel \u6846\u67b6\u8f7b\u677e\u5c01\u88c5\u652f\u4ed8\u548c\u652f\u4ed8\uff1f\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>\u6846\u67b6\u4e2d\u652f\u4ed8\u548c\u652f\u4ed8\u5c01\u88c5\u65b9\u6848 \u5c01\u88c5\u7b2c\u4e09\u65b9\u652f\u4ed8\u63a5\u53e3\u662f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u5e38\u89c1\u9700\u6c42\uff0c\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528 Laravel \u6846\u67b6\u5c01\u88c5\u548c\u652f\u4ed8\u5b9d\u652f\u4ed8\u3002 \u73b0\u6709\u7684\u7b2c\u4e09\u65b9\u652f\u4ed8\u5c01\u88c5\u5e93\u7e41\u591a\uff0c\u5efa\u8bae\u76f4\u63a5\u91c7\u7528\u6210\u719f\u4e14\u7a33\u5b9a\u7684\u5e93\u3002\u5176\u4e2d\uff0cEasyWeChat \u662f\u4e00\u4e2a\u6d3b\u8dc3\u7ef4\u62a4\u591a\u5e74\u7684\u5e93\uff0c\u7531\u539f\u817e\u8baf\u5458\u5de5\u5f00\u53d1\u3002 EasyWeChat\uff08Laravel \u7248\uff09 \u8fd9\u662f\u4e00\u4e2a\u4e13\u95e8\u9002\u7528\u4e8e Laravel \u6846\u67b6\u7684 EasyWeChat \u6269\u5c55\u5305\u3002\u5176\u7279\u70b9\u5982\u4e0b\uff1a \u63d0\u4f9b\u5fae\u4fe1\u652f\u4ed8\u548c\u652f\u4ed8\u5b9d\u652f\u4ed8\u7684\u5b8c\u6574 API \u5b9e\u73b0\u3002 \u652f\u6301\u5404\u79cd\u652f\u4ed8\u573a\u666f\uff0c\u5305\u62ec\u516c\u4f17\u53f7\u652f\u4ed8\u3001\u5c0f\u7a0b\u5e8f\u652f\u4ed8\u3001H5 \u652f\u4ed8\u7b49\u3002 \u63d0\u4f9b\u4e30\u5bcc\u7684\u6587\u6863\u548c\u793a\u4f8b\uff0c\u6613\u4e8e\u4e0a\u624b\u3002 \u5b89\u88c5\u548c\u4f7f\u7528 composer require overtrue\/laravel-wechat \u767b\u5f55\u540e\u590d\u5236 \/\/ config\/wechat.php &#8216;defaults&#8217; =&gt; [ &#8216;log&#8217; =&gt; [ &#8216;file&#8217; =&gt; storage_path(&#8216;logs\/wechat.log&#8217;), &#8216;level&#8217; =&gt; &#8216;debug&#8217;, ], ], \u767b\u5f55\u540e\u590d\u5236 use OvertrueLaravelWeChatFacade as WeChat; $wechat = WeChat::officialAccount(); $payment = $wechat-&gt;payment(); $result = $payment-&gt;order-&gt;unify([ &#8216;body&#8217; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-4073","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/4073","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=4073"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/4073\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=4073"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=4073"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=4073"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}