curl_exec(): 2 is not a valid cURL handle resource

源码

$ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE);
    curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,FALSE);//严格校验2
    curl_close($ch);
    $result = curl_exec($ch);
    if ( curl_errno($ch) ) {
        echo curl_errno($ch);
        exit;
    }

curl_errno 需在关闭前调用,将 curl_close 放至 curl_errno 后调用即可。

你可能感兴趣的:(php微信开发)