国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Table of Contents
ThinkPHP WeChat scan code payment interface, thinkphp payment interface
Home Backend Development PHP Tutorial ThinkPHP WeChat scan code payment interface, thinkphp payment interface_PHP tutorial

ThinkPHP WeChat scan code payment interface, thinkphp payment interface_PHP tutorial

Jul 12, 2016 am 08:55 AM
thinkphp WeChat Scan code interface pay

ThinkPHP WeChat scan code payment interface, thinkphp payment interface

Recently I have been struggling with WeChat scan code payment, I read WeChat official documents, and found a lot of web pages, discoveries and documents/ The demo does not match. Now I have figured it out myself (the file name has been changed). I will post it and share it

1. Place useful official lib files and related files in the vendor

2. Call the same payment interface

WechatController

<span>//<span>調(diào)用同一支付接口<br /><span>public function <span>native(<span>$v_oid<span>=<span>'',<span>$v_amount<span>=<span>''){<br />    <span>ini_set(<span>'date.timezone',<span>'Asia/Shanghai');<br />    <span>error_reporting(<span>E_ERROR);<br />    <span>//<span>添加相關(guān)的類文件<br /><span>    <span>vendor(<span>'Wxpay.WxPayApi');<br />    <span>vendor(<span>'Wxpay.log');<br />    <span>vendor(<span>'Wxpay.NativePay');<br />    <span>//<span>初始化日志<br /><span>    <span>$logHandler<span>= new \<span>CLogFileHandler(<span>"../logs/"<span>.<span>date(<span>'Y-m-d')<span>.<span>'.log');<br />    <span>$log <span>= \<span>Log<span>::<span>Init(<span>$logHandler, <span>15);<br />    <span>//<span>接受訂單信息<br /><span>    <span>if(<span>trim(<span>$v_oid)<span><><span>"")               <span>//<span>判斷是否有傳遞訂單號<br /><span>    {<br />        <span>$v_oid <span>= <span>trim(<span>$v_oid);<br />    }<br />    <span>else<br /><span>    {<br />        <span>$this<span>-><span>error(<span>'<span>訂單號為空<span>',<span>U(<span>'User/index'));<br />        <span>exit;<br />    }<br /><br />    <span>$v_amount <span>= <span>trim(<span>$v_amount<span>*<span>100);                   <span>//<span>支付金額<br /><span><br /><span>    <span>//<span>調(diào)用同一支付接口<br /><span>    <span>$notify <span>= new \<span>NativePay();<br />    <span>$input <span>= new \<span>WxPayUnifiedOrder();<br />    <span>//<span>商品描述<span>----------------------------<span>需要參數(shù)傳遞<span>/<span>統(tǒng)一信息<br /><span>    <span>$input<span>-><span>SetBody(<span>"<span>商品描述位置<span>");<br />    <span>//<span>附加數(shù)據(jù)<br /><span>    <span>$input<span>-><span>SetAttach(<span>"<span>附加數(shù)據(jù)位置<span>");<br />    <span>//<span>商戶訂單號<br /><span>    <span>$input<span>-><span>SetOut_trade_no(<span>$v_oid);<br />    <span>//<span>總金額<br /><span>    <span>$input<span>-><span>SetTotal_fee(<span>$v_amount);<br />    <span>//<span>開始時間<br /><span>    <span>$input<span>-><span>SetTime_start(<span>date(<span>"YmdHis"));<br />    <span>//<span>結(jié)束時間<br /><span>    <span>$input<span>-><span>SetTime_expire(<span>date(<span>"YmdHis", <span>time() <span>+ <span>600));<br />    <span>//<span>商品標(biāo)記<br /><span>    <span>$input<span>-><span>SetGoods_tag(<span>"<span>商品標(biāo)記位置<span>");<br />    <span>//<span>異步通知地址<span>,<span>不能攜帶任何參數(shù)<br /><span>    <span>$input<span>-><span>SetNotify_url(<span>U(<span>'NotifyProcess'));<br />    <span>//<span>交易類型<br /><span>    <span>$input<span>-><span>SetTrade_type(<span>"NATIVE");<br />    <span>//<span>商品<span>id<br /><span>    <span>$input<span>-><span>SetProduct_id(<span>"123456789");<br />    <span>//<span>獲取同一支付接口結(jié)果<br /><span>    <span>$result <span>= <span>$notify<span>-><span>GetPayUrl(<span>$input);<br />    <span>$url2 <span>= <span>$result[<span>"code_url"];<br /><br />    <span>$this<span>-><span>assign(<span>'data',<span>urlencode(<span>$url2));<br />    <span>$this<span>-><span>assign('v_oid',$v_oid);    $this->assign('v_amount',$v_amount/100);    $this->display();}三.生成二維碼</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
<span><span>三.</span><span><span>微信支付生成二維碼</span><br /><span>public function <span>qrcode(){<br />    <span>error_reporting(<span>E_ERROR);<br />    <span>vendor(<span>'Wxpay.phpqrcode.phpqrcode');<br />    <span>$url <span>= <span>$_GET[<span>"data"];<br />    \<span>QRcode<span>::<span>png(<span>$url);<br />}<br /></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><br /><span>四.異步處理</span><br /><span>具體處理流程和方式按個人需求</span>
<br /><span>//<span>微信異步查詢訂單機(jī)制<br /><span>public function <span>Queryorder(<span>$transaction_id)<br />{<br />    <span>$input <span>= new \<span>WxPayOrderQuery();<br />    <span>$input<span>-><span>SetTransaction_id(<span>$transaction_id);<br />    <span>$result <span>= \<span>WxPayApi<span>::<span>orderQuery(<span>$input);<br />    \<span>Log<span>::<span>DEBUG(<span>"query:" <span>. <span>json_encode(<span>$result));<br />    <span>if(<span>array_key_exists(<span>"return_code", <span>$result)<br />        <span>&& <span>array_key_exists(<span>"result_code", <span>$result)<br />        <span>&& <span>$result[<span>"return_code"] <span>== <span>"SUCCESS"<br /><span>        <span>&& <span>$result[<span>"result_code"] <span>== <span>"SUCCESS")<br />    {<br />        <span>return true;<br />    }<br />    <span>return false;<br />}<br /><br /></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span>五.再來個form表單展示二維碼</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><br /></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
<span><<span>form <span>action=<span>"" <span>method=<span>"post" <span>id=<span>"myForm-table"><br />    <<span>h2><span>訂單信息</<span>h2><br />    <<span>div <span>class=<span>"orderNumber"><br />        <<span>p <span>class=<span>"a"><span>訂單號:<span>"{$v_oid}"</<span>p><br />        <<span>p <span>class=<span>"b"><br />            <<span>span <span>class=<span>"left"><span>應(yīng)付金額:<<span>strong><<span>em><span>{$v_amount}</<span>em><span>元</<span>strong></<span>span><br />            <<span>span <span>class=<span>"right"><span>付款后,飛行之翼客服會與您聯(lián)系,如有問題請咨詢<span>24<span>小時飛行熱線 <span>400-700-2016</<span>span><br />        </<span>p><br />    </<span>div><br />    <<span>h2><span>微信支付</<span>h2><br />    <<span>img <span>src=<span>"{:U('qrcode')}?data={$data}" <span>alt=<span>"<span>微信掃碼<span>"><br />    <<span>div <span>class=<span>"order-submit"><<span>a <span>href=<span>"javascript:<span>history<span>.<span>go<span>(-1);" <span>class=<span>"submitOrder Order"><span>返回其他支付方式</<span>a></<span>div><br /></<span>form></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><br /><br /><br /><span>成功的圖就不附上了,這是我遇到的問題,由于要重構(gòu),所以比較亂,無效代碼也比較多,需要整理,記錄下來,分享一二</span>
<span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span><span> </span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
<br /><br />

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1114481.htmlTechArticleThinkPHP WeChat scan code payment interface, thinkphp payment interface. Recently, I have been struggling with WeChat scan code payment. After reading the official WeChat documentation, I found I read a lot of web pages and found that they don’t match the documentation/demo. Now I’ve done it myself...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Is the company's security software causing the application to fail to run? How to troubleshoot and solve it? Is the company's security software causing the application to fail to run? How to troubleshoot and solve it? Apr 19, 2025 pm 04:51 PM

Troubleshooting and solutions to the company's security software that causes some applications to not function properly. Many companies will deploy security software in order to ensure internal network security. ...

The difference between H5 and mini-programs and APPs The difference between H5 and mini-programs and APPs Apr 06, 2025 am 10:42 AM

H5. The main difference between mini programs and APP is: technical architecture: H5 is based on web technology, and mini programs and APP are independent applications. Experience and functions: H5 is light and easy to use, with limited functions; mini programs are lightweight and have good interactiveness; APPs are powerful and have smooth experience. Compatibility: H5 is cross-platform compatible, applets and APPs are restricted by the platform. Development cost: H5 has low development cost, medium mini programs, and highest APP. Applicable scenarios: H5 is suitable for information display, applets are suitable for lightweight applications, and APPs are suitable for complex functions.

What are the development tools for H5 and mini program? What are the development tools for H5 and mini program? Apr 06, 2025 am 09:54 AM

H5 development tools recommendations: VSCode, WebStorm, Atom, Brackets, Sublime Text; Mini Program Development Tools: WeChat Developer Tools, Alipay Mini Program Developer Tools, Baidu Smart Mini Program IDE, Toutiao Mini Program Developer Tools, Taro.

What is the difference between an abstract class and an interface in PHP? What is the difference between an abstract class and an interface in PHP? Apr 08, 2025 am 12:08 AM

The main difference between an abstract class and an interface is that an abstract class can contain the implementation of a method, while an interface can only define the signature of a method. 1. Abstract class is defined using abstract keyword, which can contain abstract and concrete methods, suitable for providing default implementations and shared code. 2. The interface is defined using the interface keyword, which only contains method signatures, which is suitable for defining behavioral norms and multiple inheritance.

The difference between laravel and thinkphp The difference between laravel and thinkphp Apr 18, 2025 pm 01:09 PM

Laravel and ThinkPHP are both popular PHP frameworks and have their own advantages and disadvantages in development. This article will compare the two in depth, highlighting their architecture, features, and performance differences to help developers make informed choices based on their specific project needs.

How to choose H5 and applets How to choose H5 and applets Apr 06, 2025 am 10:51 AM

The choice of H5 and applet depends on the requirements. For applications with cross-platform, rapid development and high scalability, choose H5; for applications with native experience, rich functions and platform dependencies, choose applets.

What are the different ways of promoting H5 and mini programs? What are the different ways of promoting H5 and mini programs? Apr 06, 2025 am 11:03 AM

There are differences in the promotion methods of H5 and mini programs: platform dependence: H5 depends on the browser, and mini programs rely on specific platforms (such as WeChat). User experience: The H5 experience is poor, and the mini program provides a smooth experience similar to native applications. Communication method: H5 is spread through links, and mini programs are shared or searched through the platform. H5 promotion methods: social sharing, email marketing, QR code, SEO, paid advertising. Mini program promotion methods: platform promotion, social sharing, offline promotion, ASO, cooperation with other platforms.

The latest news APP ranking recommendation in the currency circle (authoritative release in 2025) The latest news APP ranking recommendation in the currency circle (authoritative release in 2025) Apr 21, 2025 pm 09:33 PM

The best cryptocurrency trading and analysis platforms include: 1. OKX: the world's number one in trading volume, supports multiple transactions, provides AI market analysis and on-chain data monitoring. 2. Binance: The world's largest exchange, providing in-depth market conditions and new currency first-time offerings. 3. Sesame Open Door: Known for spot trading and OTC channels, it provides automated trading strategies. 4. CoinMarketCap: an authoritative market data platform, covering 20,000 currencies. 5. CoinGecko: Known for community sentiment analysis, it provides DeFi and NFT trend monitoring. 6. Non-small account: a domestic market platform, providing analysis of linkage between A-shares and currency markets. 7. On-chain Finance: Focus on blockchain news and update in-depth reports every day. 8. Golden Finance: 24 small

See all articles