$opts = array( 'http' => array( 'method' => "GET", 'timeout' => 10,//单位秒 ), 'ssl' => array( "verify_peer"=>false, //取消验证https "verify_peer_name"=>false, ) ); file_get_contents($url, false, stream_context_create($opts)); //超时返回false
$opts = array( 'http' => array( 'method' => "GET", 'timeout' => 10,//单位秒 ), 'ssl' => array( "verify_peer"=>false, //取消验证https "verify_peer_name"=>false, ) ); file_get_contents($url, false, stream_context_create($opts)); //超时返回false