PHP读取微信超时,'curl出错,错误码:28'
PHP讀取微信認(rèn)證超時(shí),錯(cuò)誤如下:
[error] 1548#0: *137 FastCGI sent in stderr: "PHP message: PHP Fatal error: ?Uncaught exception 'WxPayException' with message 'curl出錯(cuò),錯(cuò)誤碼:28' in /home/cat/html/releases/20160825025148/lib/WxPay.Api.php:566
錯(cuò)誤代碼28表示超時(shí),有的網(wǎng)站說吧 second更改為60 ,如下
private static function postXmlCurl($xml, $url, $useCert = false, $second = 60)
{
$ch = curl_init();
//設(shè)置超時(shí)
curl_setopt($ch, CURLOPT_TIMEOUT, $second);
……………………
經(jīng)過小編嘗試根本不管用
正確的做法應(yīng)該是更改函數(shù)?unifiedOrder 的參數(shù)timeout的值,默認(rèn)是6,增大為你可以使用的狀態(tài)為止
public static function unifiedOrder($inputObj, $timeOut = 6)
{
$url = "https://api.mch.weixin.qq.com/pay/unifiedorder";
//檢測(cè)必填參數(shù)
if(!$inputObj->IsOut_trade_noSet()) {
throw new WxPayException("缺少統(tǒng)一支付接口必填參數(shù)out_trade_no!");
}else if(!$inputObj->IsBodySet()){
throw new WxPayException("缺少統(tǒng)一支付接口必填參數(shù)body!");
}else if(!$inputObj->IsTotal_feeSet()) {
throw new WxPayException("缺少統(tǒng)一支付接口必填參數(shù)total_fee!");
}else if(!$inputObj->IsTrade_typeSet()) {
throw new WxPayException("缺少統(tǒng)一支付接口必填參數(shù)trade_type!");
}
參考:curl返回常見錯(cuò)誤碼
http://www.cnblogs.com/wainiwann/p/3492939.html
轉(zhuǎn)載于:https://blog.51cto.com/dongyonggang/1842464
與50位技術(shù)專家面對(duì)面20年技術(shù)見證,附贈(zèng)技術(shù)全景圖總結(jié)
以上是生活随笔為你收集整理的PHP读取微信超时,'curl出错,错误码:28'的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 解决mysql 1032 主从错误
- 下一篇: jquery获取data-*返回unde