(用微信扫的静态链接二维码)微信native支付模式官方提供的demo文件中的几个bug修正,nativedemo
(用微信扫的静态链接二维码)微信native支付模式官方提供的demo文件中的几个bug修正,nativedemo
native支付模式一demo(用微信扫的静态链接二维码)BUG修复,一共4个BUG
1.native_call_qrcode.php这个文件中的代码无法生存native支付的短地址
2.WxPayPubHelper.php中某个代码获取不到WxPayConf_pub类定义的常量CURL_TIMEOUT
3.WxPayPubHelper.php curl中cURL会话并且异常释放资源
4.微信支付长地址转换地址函数有误
1.纠正短微信短地址未生成支付二维码问题,页面地址native_call_qrcode.php
第39行:因为官方的$codeUrl获得为空。
第59行:
<span>var</span> url = "<?php echo <span>$product_url</span>;?>";
获得是长地址
修改为短地址:
<span>var</span> url = "<?php echo <span>$codeUrl</span>;?>";
长地址的字符信息量太大常常会导致扫码失败。
2.WxPayPubHelper.php中某个代码获取不到WxPayConf_pub类定义的常量CURL_TIMEOUT
WxPayPubHelper/WxPayPubHelper.php
第155行
curl_setopt(<span>$ch</span>, CURLOP_TIMEOUT, <span>$second</span>);
这里获取不到CURLOP_TIMEOUT
应该改成
curl_setopt(<span>$ch</span>, WxPayConf_pub::CURL_TIMEOUT, <span>$second</span>);
3.WxPayPubHelper.php curl中cURL会话并且异常释放资源
第176行 return $data;是画蛇添足的的,这里也会报错,因为第171行:
curl_close(<span>$ch</span>);
已经关闭流
4.微信支付长地址转换地址函数有误
第600行 getShortUrl()获取不到短地址,
<span>function</span><span> getShortUrl() { </span><span>$this</span>-><span>postXml(); </span><span>$prepay_id</span> = <span>$this</span>->result["short_url"<span>]; </span><span>return</span> <span>$prepay_id</span><span>; }</span>
修改如下
<span>function</span><span> getShortUrl() { </span><span>$this</span>-><span>postXml(); </span><span>$postObj</span> = <span>simplexml_load_string</span>(<span>$this</span>->response, 'SimpleXMLElement',<span> LIBXML_NOCDATA); </span><span>$prepay_id</span> = <span>$postObj</span>-><span>short_url; </span><span>return</span> <span>$prepay_id</span><span>; }</span>
微信开发交流 QQ:187395037 电话:15889726201

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Atom editor mac version download
The most popular open source editor

SublimeText3 Linux new version
SublimeText3 Linux latest version

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),