PHP读取微信超时,'curl出错,错误码:28'

发布时间:2020-07-04 17:37:26 作者:鹰击长空飞
来源:网络 阅读:7457

PHP读取微信认证超时,错误如下:


[error] 1548#0: *137 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught exception 'WxPayException' with message 'curl出错,错误码:28' in /home/cat/html/releases/20160825025148/lib/WxPay.Api.php:566


错误代码28表示超时,有的网站说吧 second更改为60 ,如下

private static function postXmlCurl($xml, $url, $useCert = false, $second = 60)

{

$ch = curl_init();

//设置超时

curl_setopt($ch, CURLOPT_TIMEOUT, $second);

……………………


经过小编尝试根本不管用


正确的做法应该是更改函数 unifiedOrder 的参数timeout的值,默认是6,增大为你可以使用的状态为止

public static function unifiedOrder($inputObj, $timeOut = 6)

{

$url = "https://api.mch.weixin.qq.com/pay/unifiedorder";

//检测必填参数

if(!$inputObj->IsOut_trade_noSet()) {

throw new WxPayException("缺少统一支付接口必填参数out_trade_no!");

}else if(!$inputObj->IsBodySet()){

throw new WxPayException("缺少统一支付接口必填参数body!");

}else if(!$inputObj->IsTotal_feeSet()) {

throw new WxPayException("缺少统一支付接口必填参数total_fee!");

}else if(!$inputObj->IsTrade_typeSet()) {

throw new WxPayException("缺少统一支付接口必填参数trade_type!");

}



参考:curl返回常见错误码

http://www.cnblogs.com/wainiwann/p/3492939.html


附件:http://down.51cto.com/data/2368096
推荐阅读:
  1. HTML5余下标签
  2. Android App端与PHP Web端的简单数据交互的示例分析

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

php

上一篇:Linux高可用集群方案之heartbeat基础原理及逻辑架构

下一篇:iframe 跨域自适应高度

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》