zoukankan      html  css  js  c++  java
  • 微信支付问题

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

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

    WxPayPubHelperWxPayPubHelper.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;  
        }  

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

  • 相关阅读:
    Educational Codeforces Round 86 (Rated for Div. 2) D. Multiple Testcases
    Educational Codeforces Round 86 (Rated for Div. 2) C. Yet Another Counting Problem
    HDU
    HDU
    HDU
    HDU
    Good Bye 2019 C. Make Good (异或的使用)
    Educational Codeforces Round 78 (Rated for Div. 2) C. Berry Jam
    codeforces 909C. Python Indentation
    codeforces1054 C. Candies Distribution
  • 原文地址:https://www.cnblogs.com/lamp01/p/6645997.html
Copyright © 2011-2022 走看看