当前位置: 移动技术网 > IT编程>开发语言>其他编程 > 微信支付 :curl出错,错误码:60两个问题的解决

微信支付 :curl出错,错误码:60两个问题的解决

2017年12月08日  | 移动技术网IT编程  | 我要评论

如下是运行微信支付测试代码时出错代码:

warning: curl_setopt() expects parameter 2 to be long, string given in d:\wwwroot\weixinpaytest\pay\wxpay.jsapipay.php on line 99
 
fatal error: uncaught exception ‘wxpayexception‘ with message ‘curl出错,错误码:60‘ in d:\wwwroot\weixinpaytest\lib\wxpay.api.php:564 stack trace: #0 d:\wwwroot\weixinpaytest\lib\wxpay.api.php(62):
 
wxpayapi::postxmlcurl(‘<xml><appid><![...‘, ‘https://api.mch...‘, false, 6) #1 d:\wwwroot\weixinpaytest\pay\jsapi.php(36):
 
wxpayapi::unifiedorder(object(wxpayunifiedorder)) #2 {main} thrown in d:\wwwroot\weixinpaytest\lib\wxpay.api.php on line 564
 

第一个问题,这个问题完全是微信团队的问题,给出的example就是错的:

warning: curl_setopt() expects parameter 2 to be long, string given in d:\wwwroot\weixinpaytest\pay\wxpay.jsapipay.php on line 99 

找到wxpay.jsapipay.php文件的99行,curl_setopt($ch, curlop_timeout, 30);
微信团队example代码里少了一个“t”,正确代码应该是 curl_setopt($ch, curlopt_timeout, 30); 

 这样,这一个问题就解决了。

 下面说第二个问题:

 fatal error: uncaught exception ‘wxpayexception‘ with message ‘curl出错,错误码:60‘ in d:\wwwroot\weixinpaytest\lib\wxpay.api.php:564 stack trace: #0d:\wwwroot\weixinpaytest\lib\wxpay.api.php(62): 
 wxpayapi::postxmlcurl(‘<xml><appid><![...‘, ‘https://api.mch...‘, false, 6) #1 d:\wwwroot\weixinpaytest\pay\jsapi.php(36): 
 wxpayapi::unifiedorder(object(wxpayunifiedorder)) #2 {main} thrown in d:\wwwroot\weixinpaytest\lib\wxpay.api.php on line 564

 这个错误通过修改文件wxpay.api.php 解决,具体如下:

 第537行
curl_setopt($ch,curlopt_ssl_verifypeer,true);
curl_setopt($ch,curlopt_ssl_verifyhost,2);//严格校验

to

curl_setopt($ch,curlopt_ssl_verifypeer,false);
curl_setopt($ch,curlopt_ssl_verifyhost,false);//严格校验2

这样,这两个问题就解决了!祝你好运!

以上就是对微信支付出现问题的资料整理,后续继续补充相关资料谢谢大家对本站的支持!

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网