(Use WeChat to scan the static link QR code) several bug fixes in the demo file officially provided by WeChat native payment mode. nativedemo_PHP tutorial

Source: Internet
Author: User
(Scan the static link QR code) native payment mode provides several bug fixes in the demo file, nativedemo. (Scan the static link QR code) several bug fixes in the demo file officially provided by native payment mode, nativedemonative payment mode 1 demo (static link QR code scanned) several bug fixes in the demo file officially provided by native payment mode, nativedemo

Native payment mode 1 demo (scan the static link QR code) BUG fix, a total of 4 bugs

1. the code in the native_call_qrcode.php file cannot survive the short address paid by native
2. a code in WxPayPubHelper. php cannot obtain the constant CURL_TIMEOUT defined by the WxPayConf_pub class.
3. curl session in WxPayPubHelper. php cURL and abnormal resource release
4. incorrect payment long address translation address function

1. correct the problem that the payment QR code is not generated for the short address. the page address is native_call_qrcode.php.
Row 39th: because the official$ CodeUrlThe result is null.
Row 3:

var url = "
 ";

Obtain a long address
Change to short address:

var url = "
 ";

Scanning fails because the characters with long addresses are too informative.

2. a code in WxPayPubHelper. php cannot obtain the constant CURL_TIMEOUT defined by the WxPayConf_pub class.


WxPayPubHelper/WxPayPubHelper. php
155th rows

curl_setopt($ch, CURLOP_TIMEOUT, $second);

CURLOP_TIMEOUT cannot be obtained here
Should be changed

curl_setopt($ch, WxPayConf_pub::CURL_TIMEOUT, $second);

3. curl session in WxPayPubHelper. php cURL and abnormal resource release
The 176th rows return $ data; are superfluous, and an error is reported here, because the 171st rows:

curl_close($ch);

Stream disabled

4. incorrect payment long address translation address function
No short address can be obtained from getcursurl () in row 3,

function getShortUrl(){$this->postXml();$prepay_id = $this->result["short_url"];return $prepay_id;}

Modify as follows:

function getShortUrl(){$this->postXml();$postObj = simplexml_load_string($this->response, 'SimpleXMLElement', LIBXML_NOCDATA);$prepay_id = $postObj->short_url;return $prepay_id;}

QQ: 187395037 Tel: 15889726201

Http://www.bkjia.com/PHPjc/909746.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/909746.htmlTechArticle (with scan static link QR code) native payment mode provided by the official demo file in a few bug fixes, nativedemo native payment mode a demo (with scan static link QR code...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.