微信支付问题

1、出现redirect_uri参数错误是因为公众号后台授权回调页面没有填写域名,详见http://jingyan.baidu.com/article/91f5db1b3659811c7e05e357.html

2、出现Notice: Use of undefined constant CURLOP_TIMEOUT - assumed 'CURLOP_TIMEOUT' in D:\PHP\htdocs\pay\wx\WxPayPubHelper\WxPayPubHelper.php on line 823
     Warning: curl_setopt() expects parameter 2 to be long, string given in D:\PHP\htdocs\pay\wx\WxPayPubHelper\WxPayPubHelper.php on line 823是因为微信团队给的代码的问题

WxPayPubHelper\WxPayPubHelper.php这个文件:

    public function GetOpenidFromMp($code)  
    {  
        $url = $this->__CreateOauthUrlForOpenid($code);  
        //初始化curl  
        $ch = curl_init();  
        //设置超时  
        curl_setopt($ch, CURLOPT_TIMEOUT, 30);//这里少了个T【CURLOP_TIMEOUT , CURLOPT_TIMEOUT】  
        curl_setopt($ch, CURLOPT_URL, $url);  
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,FALSE);  
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,FALSE);  
        curl_setopt($ch, CURLOPT_HEADER, FALSE);  
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);  
        if(WxPayConfig::CURL_PROXY_HOST != "0.0.0.0"   
            && WxPayConfig::CURL_PROXY_PORT != 0){  
            curl_setopt($ch,CURLOPT_PROXY, WxPayConfig::CURL_PROXY_HOST);  
            curl_setopt($ch,CURLOPT_PROXYPORT, WxPayConfig::CURL_PROXY_PORT);  
        }  
        //运行curl,结果以jason形式返回  
        $res = curl_exec($ch);  
        curl_close($ch);  
        //取出openid  
        $data = json_decode($res,true);  
        $this->data = $data;  
        $openid = $data['openid'];  
        return $openid;  
    }  

更改以后就可以正常运行了

转载于:https://www.cnblogs.com/lamp01/p/6645997.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值