PHP 微信开发 支付失败 curl_setopt()

WBOY
Lepaskan: 2016-06-06 20:31:45
asal
1320 orang telah melayarinya

<code>PHP Warning: curl_setopt() expects parameter 2 to be long, string given in E:\wwwroot\pay3\WxPayPubHelper\WxPayPubHelper.php on line 821
</code>
Salin selepas log masuk
Salin selepas log masuk
<code>/**
     *  作用:通过curl向微信提交code,以获取openid
     */
    function getOpenid()
    {
        $url = $this->createOauthUrlForOpenid();
        //初始化curl
        $ch = curl_init();
        //设置超时
        curl_setopt($ch, CURLOP_TIMEOUT, $this->curl_timeout);  821行代码
        echo $this->curl_timeout;
        exit;
        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);
        //运行curl,结果以jason形式返回
        $res = curl_exec($ch);
        curl_close($ch);
        //取出openid
        $data = json_decode($res,true);
        $this->openid = $data['openid'];
        return $this->openid;
    }
</code>
Salin selepas log masuk
Salin selepas log masuk

回复内容:

<code>PHP Warning: curl_setopt() expects parameter 2 to be long, string given in E:\wwwroot\pay3\WxPayPubHelper\WxPayPubHelper.php on line 821
</code>
Salin selepas log masuk
Salin selepas log masuk
<code>/**
     *  作用:通过curl向微信提交code,以获取openid
     */
    function getOpenid()
    {
        $url = $this->createOauthUrlForOpenid();
        //初始化curl
        $ch = curl_init();
        //设置超时
        curl_setopt($ch, CURLOP_TIMEOUT, $this->curl_timeout);  821行代码
        echo $this->curl_timeout;
        exit;
        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);
        //运行curl,结果以jason形式返回
        $res = curl_exec($ch);
        curl_close($ch);
        //取出openid
        $data = json_decode($res,true);
        $this->openid = $data['openid'];
        return $this->openid;
    }
</code>
Salin selepas log masuk
Salin selepas log masuk

curl_setopt($ch, CURLOPT_TIMEOUT, $this->curl_timeout); 821行代码 //字母写错了

Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan