{"id":2693,"date":"2024-11-10T08:50:59","date_gmt":"2024-11-10T00:50:59","guid":{"rendered":"https:\/\/fwq.ai\/blog\/2693\/"},"modified":"2024-11-10T08:50:59","modified_gmt":"2024-11-10T00:50:59","slug":"laravel-%e6%a1%86%e6%9e%b6%e4%b8%ad%e5%a6%82%e4%bd%95%e6%97%a0%e7%bc%9d%e9%9b%86%e6%88%90%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\/2693\/","title":{"rendered":"Laravel \u6846\u67b6\u4e2d\u5982\u4f55\u65e0\u7f1d\u96c6\u6210\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\/173085877919550.jpg\" class=\"aligncenter\" title=\"Laravel \u6846\u67b6\u4e2d\u5982\u4f55\u65e0\u7f1d\u96c6\u6210\u5fae\u4fe1\u652f\u4ed8\u548c\u652f\u4ed8\u5b9d\u652f\u4ed8\uff1f\u63d2\u56fe\" alt=\"Laravel \u6846\u67b6\u4e2d\u5982\u4f55\u65e0\u7f1d\u96c6\u6210\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\u7684\u5c01\u88c5<\/strong><\/p>\n<p>\u5982\u4f55\u5c06\u548c\u652f\u4ed8\u5b9d\u652f\u4ed8\u65e0\u7f1d\u96c6\u6210\u5230 laravel \u6846\u67b6\u4e2d\uff1f<\/p>\n<p><strong>\u5efa\u8bae\u89e3\u51b3\u65b9\u6848<\/strong><\/p>\n<p>\u8003\u8651\u4f7f\u7528 easywechat \u7684 laravel \u7248\u672c\u3002easywechat \u662f\u4e00\u4e2a\u6210\u719f\u3001\u7ef4\u62a4\u826f\u597d\u7684\u5e93\uff0c\u7531\u817e\u8baf\u5b98\u65b9\u4eba\u5458\u5f00\u53d1\uff0c\u4e13\u4e3a\u5904\u7406\u5fae\u4fe1\u76f8\u5173\u529f\u80fd\u800c\u8bbe\u8ba1\u3002\u5176 laravel \u7248\u672c\u63d0\u4f9b\u4e86\u4e00\u4e2a\u4fbf\u6377\u7684\u63a5\u53e3\uff0c\u7528\u4e8e\u5c01\u88c5\u5fae\u4fe1\u652f\u4ed8\u6d41\u7a0b\u3002<\/p>\n<p><strong>\u5b89\u88c5\u548c\u914d\u7f6e<\/strong><\/p>\n<p>\u901a\u8fc7  \u5b89\u88c5 easywechat\uff1a<\/p>\n<pre>composer require overtrue\/laravel-wechat<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728 config\/app.php \u6587\u4ef6\u4e2d\u6dfb\u52a0\u670d\u52a1\u63d0\u4f9b\u8005\uff1a<\/p>\n<pre>'providers' =&gt; [\n    \/\/ ...\n    overtruelaravelwechatserviceprovider::class,\n    \/\/ ...\n],<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728 config\/wechat.php \u6587\u4ef6\u4e2d\u914d\u7f6e\u5fae\u4fe1\u652f\u4ed8\u548c\u652f\u4ed8\u5b9d\u652f\u4ed8\u7684\u51ed\u636e\u548c\u5176\u4ed6\u8bbe\u7f6e\u3002<\/p>\n<p><strong>\u4f7f\u7528<\/strong><\/p>\n<p>\u4f7f\u7528 easywechat \u63d0\u4f9b\u7684\u4fbf\u6377\u65b9\u6cd5\u8fdb\u884c\u652f\u4ed8\uff1a<\/p>\n<pre>$payment = app('wechat')-&gt;payment();\n\n\/\/ \u521b\u5efa\u4e00\u4e2a\u8ba2\u5355\n$order = $payment-&gt;order-&gt;create([\n    \/\/ \u8ba2\u5355\u6570\u636e\n]);\n\n\/\/ \u751f\u6210\u652f\u4ed8\u94fe\u63a5\n$url = $payment-&gt;order-&gt;url($order['id']);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>easywechat \u63d0\u4f9b\u4e86\u5176\u4ed6\u65b9\u6cd5\uff0c\u7528\u4e8e\u5904\u7406\u4ed8\u6b3e\u901a\u77e5\u3001\u548c\u66f4\u591a\u652f\u4ed8\u76f8\u5173\u64cd\u4f5c\u3002<\/p>\n<p><strong>\u5176\u4ed6\u9009\u9879<\/strong><\/p>\n<ul>\n<li> <strong>stripe\uff1a<\/strong>\u53e6\u4e00\u4e2a\u7528\u4e8e\u5904\u7406\u652f\u4ed8\u7684\u6d41\u884c\u5e93\uff0c\u5728 laravel \u4e2d\u6709\u5f88\u597d\u7684\u96c6\u6210\u9009\u9879\u3002<\/li>\n<li> <strong>paypal\uff1a<\/strong>\u4e00\u4e2a\u8001\u724c\u7684\u652f\u4ed8\u7f51\u5173\uff0c\u4e5f\u6709\u4e00\u4e2a laravel sdk\u3002<\/li>\n<li> <strong>\u624b\u5199\u5c01\u88c5\uff1a<\/strong>\u5982\u679c\u4f60\u66f4\u613f\u610f\u4ece\u5934\u5f00\u59cb\uff0c\u4e5f\u53ef\u4ee5\u624b\u52a8\u5c01\u88c5\u652f\u4ed8\u6d41\u7a0b\u3002\u4f46\u662f\uff0c\u8fd9\u5c06\u9700\u8981\u66f4\u591a\u7684\u5f00\u53d1\u5de5\u4f5c\u548c\u7ef4\u62a4\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662fLaravel \u6846\u67b6\u4e2d\u5982\u4f55\u65e0\u7f1d\u96c6\u6210\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\u7684\u5c01\u88c5 \u5982\u4f55\u5c06\u548c\u652f\u4ed8\u5b9d\u652f\u4ed8\u65e0\u7f1d\u96c6\u6210\u5230 laravel \u6846\u67b6\u4e2d\uff1f \u5efa\u8bae\u89e3\u51b3\u65b9\u6848 \u8003\u8651\u4f7f\u7528 easywechat \u7684 laravel \u7248\u672c\u3002easywechat \u662f\u4e00\u4e2a\u6210\u719f\u3001\u7ef4\u62a4\u826f\u597d\u7684\u5e93\uff0c\u7531\u817e\u8baf\u5b98\u65b9\u4eba\u5458\u5f00\u53d1\uff0c\u4e13\u4e3a\u5904\u7406\u5fae\u4fe1\u76f8\u5173\u529f\u80fd\u800c\u8bbe\u8ba1\u3002\u5176 laravel \u7248\u672c\u63d0\u4f9b\u4e86\u4e00\u4e2a\u4fbf\u6377\u7684\u63a5\u53e3\uff0c\u7528\u4e8e\u5c01\u88c5\u5fae\u4fe1\u652f\u4ed8\u6d41\u7a0b\u3002 \u5b89\u88c5\u548c\u914d\u7f6e \u901a\u8fc7 \u5b89\u88c5 easywechat\uff1a composer require overtrue\/laravel-wechat \u767b\u5f55\u540e\u590d\u5236 \u5728 config\/app.php \u6587\u4ef6\u4e2d\u6dfb\u52a0\u670d\u52a1\u63d0\u4f9b\u8005\uff1a &#8216;providers&#8217; =&gt; [ \/\/ &#8230; overtruelaravelwechatserviceprovider::class, \/\/ &#8230; ], \u767b\u5f55\u540e\u590d\u5236 \u5728 config\/wechat.php \u6587\u4ef6\u4e2d\u914d\u7f6e\u5fae\u4fe1\u652f\u4ed8\u548c\u652f\u4ed8\u5b9d\u652f\u4ed8\u7684\u51ed\u636e\u548c\u5176\u4ed6\u8bbe\u7f6e\u3002 \u4f7f\u7528 \u4f7f\u7528 easywechat \u63d0\u4f9b\u7684\u4fbf\u6377\u65b9\u6cd5\u8fdb\u884c\u652f\u4ed8\uff1a $payment = app(&#8216;wechat&#8217;)-&gt;payment(); \/\/ \u521b\u5efa\u4e00\u4e2a\u8ba2\u5355 $order = $payment-&gt;order-&gt;create([ \/\/ \u8ba2\u5355\u6570\u636e ]); \/\/ \u751f\u6210\u652f\u4ed8\u94fe\u63a5 $url [&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-2693","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/2693","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=2693"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/2693\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=2693"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=2693"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=2693"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}