{"id":7685,"date":"2024-11-14T14:55:30","date_gmt":"2024-11-14T06:55:30","guid":{"rendered":"https:\/\/fwq.ai\/blog\/7685\/"},"modified":"2024-11-14T14:55:30","modified_gmt":"2024-11-14T06:55:30","slug":"%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8-laravel-%e8%bd%bb%e6%9d%be%e6%95%b4%e5%90%88%e5%be%ae%e4%bf%a1%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\/7685\/","title":{"rendered":"\u5982\u4f55\u4f7f\u7528 Laravel \u8f7b\u677e\u6574\u5408\u5fae\u4fe1\u548c\u652f\u4ed8\u5b9d\u652f\u4ed8\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173114352547828.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u4f7f\u7528 Laravel \u8f7b\u677e\u6574\u5408\u5fae\u4fe1\u548c\u652f\u4ed8\u5b9d\u652f\u4ed8\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u4f7f\u7528 Laravel \u8f7b\u677e\u6574\u5408\u5fae\u4fe1\u548c\u652f\u4ed8\u5b9d\u652f\u4ed8\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong> \u6574\u5408\u548c\u652f\u4ed8<\/strong><\/p>\n<p>\u5728 laravel \u6846\u67b6\u4e2d\uff0c\u6574\u5408\u5fae\u4fe1\u548c\u652f\u4ed8\u5b9d\u652f\u4ed8\u53ef\u4ee5\u4e3a\u7535\u5b50\u5546\u52a1\u7f51\u7ad9\u6216\u5e94\u7528\u7a0b\u5e8f\u5e26\u6765\u6781\u5927\u7684\u4fbf\u5229\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u4f7f\u7528\u73b0\u6210\u7684 laravel \u5305\u6765\u8f7b\u677e\u5c01\u88c5\u8fd9\u4e9b\u652f\u4ed8\u7f51\u5173\uff1a<\/p>\n<p><strong>\u63a8\u8350\u89e3\u51b3\u65b9\u6848\uff1a<\/strong><\/p>\n<p>\u5efa\u8bae\u4f7f\u7528 easywechat \u7684 laravel \u7248\u672c\uff0c\u8be5\u5e93\u7531\u817e\u8baf\u5458\u5de5\u7ef4\u62a4\uff0c\u66f4\u65b0\u9891\u7e41\u4e14\u7a33\u5b9a\u3002<\/p>\n<p><strong>\u5305\u5b89\u88c5\uff1a<\/strong><\/p>\n<pre>composer require overtrue\/laravel-wechat --prefer-dist<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u914d\u7f6e\uff1a<\/strong><\/p>\n<p>\u5728 config\/wechat.php \u914d\u7f6e\u6587\u4ef6\u4e2d\u8fdb\u884c\u5fc5\u8981\u7684\u914d\u7f6e\uff0c\u5305\u62ec\u548c\u652f\u4ed8\u5b9d\u652f\u4ed8\u7684 api \u5bc6\u94a5\u3001\u5e94\u7528 id \u7b49\u4fe1\u606f\u3002<\/p>\n<p><strong>\u4f7f\u7528\u65b9\u6cd5\uff1a<\/strong><\/p>\n<ol>\n<li><strong>\u5fae\u4fe1\u652f\u4ed8\uff1a<\/strong><\/li>\n<\/ol>\n<pre>$wechat = wechat::payment();\n$result = $wechat-&gt;order([\n    'body' =&gt; '\u8ba2\u5355\u63cf\u8ff0',\n    'total_fee' =&gt; 100,\n]);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ol>\n<li><strong>\u652f\u4ed8\u5b9d\u652f\u4ed8\uff1a<\/strong><\/li>\n<\/ol>\n<pre>$alipay = Wechat::payment('alipay');\n$result = $alipay-&gt;order([\n    'subject' =&gt; '\u8ba2\u5355\u6807\u9898',\n    'out_trade_no' =&gt; '\u8ba2\u5355\u53f7',\n    'total_amount' =&gt; 100,\n]);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8be5\u5e93\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u63a5\u53e3\uff0c\u5305\u62ec\u8ba2\u5355\u521b\u5efa\u3001\u67e5\u8be2\u3001\u548c\u5f02\u6b65\u901a\u77e5\u5904\u7406\u7b49\u529f\u80fd\uff0c\u4f7f\u652f\u4ed8\u96c6\u6210\u53d8\u5f97\u66f4\u52a0\u4fbf\u6377\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u4f7f\u7528 Laravel \u8f7b\u677e\u6574\u5408\u548c\u652f\u4ed8\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6574\u5408\u548c\u652f\u4ed8 \u5728 laravel \u6846\u67b6\u4e2d\uff0c\u6574\u5408\u5fae\u4fe1\u548c\u652f\u4ed8\u5b9d\u652f\u4ed8\u53ef\u4ee5\u4e3a\u7535\u5b50\u5546\u52a1\u7f51\u7ad9\u6216\u5e94\u7528\u7a0b\u5e8f\u5e26\u6765\u6781\u5927\u7684\u4fbf\u5229\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u4f7f\u7528\u73b0\u6210\u7684 laravel \u5305\u6765\u8f7b\u677e\u5c01\u88c5\u8fd9\u4e9b\u652f\u4ed8\u7f51\u5173\uff1a \u63a8\u8350\u89e3\u51b3\u65b9\u6848\uff1a \u5efa\u8bae\u4f7f\u7528 easywechat \u7684 laravel \u7248\u672c\uff0c\u8be5\u5e93\u7531\u817e\u8baf\u5458\u5de5\u7ef4\u62a4\uff0c\u66f4\u65b0\u9891\u7e41\u4e14\u7a33\u5b9a\u3002 \u5305\u5b89\u88c5\uff1a composer require overtrue\/laravel-wechat &#8211;prefer-dist \u767b\u5f55\u540e\u590d\u5236 \u914d\u7f6e\uff1a \u5728 config\/wechat.php \u914d\u7f6e\u6587\u4ef6\u4e2d\u8fdb\u884c\u5fc5\u8981\u7684\u914d\u7f6e\uff0c\u5305\u62ec\u548c\u652f\u4ed8\u5b9d\u652f\u4ed8\u7684 api \u5bc6\u94a5\u3001\u5e94\u7528 id \u7b49\u4fe1\u606f\u3002 \u4f7f\u7528\u65b9\u6cd5\uff1a \u5fae\u4fe1\u652f\u4ed8\uff1a $wechat = wechat::payment(); $result = $wechat-&gt;order([ &#8216;body&#8217; =&gt; &#8216;\u8ba2\u5355\u63cf\u8ff0&#8217;, &#8216;total_fee&#8217; =&gt; 100, ]); \u767b\u5f55\u540e\u590d\u5236 \u652f\u4ed8\u5b9d\u652f\u4ed8\uff1a $alipay = Wechat::payment(&#8216;alipay&#8217;); $result = $alipay-&gt;order([ &#8216;subject&#8217; =&gt; &#8216;\u8ba2\u5355\u6807\u9898&#8217;, &#8216;out_trade_no&#8217; =&gt; &#8216;\u8ba2\u5355\u53f7&#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-7685","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7685","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=7685"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7685\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=7685"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=7685"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=7685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}