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

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

  • 相关阅读:
    html基本标签练习
    实践1-qq邮箱主页
    html加强
    Date日期操作
    日期类的加减及java中所以日期类的操作算法大全
    讲解java异常
    关于Java并发编程的总结和思考
    删除map、list集合元素总结
    Jedis使用总结【pipeline】【分布式的id生成器】【分布式锁【watch】【multi】】【redis分布式】
    Java中的时间日期处理
  • 原文地址:https://www.cnblogs.com/lamp01/p/6645997.html
Copyright © 2011-2022 走看看