Home >Backend Development >PHP Tutorial >PHP file_get_contents 设置超时时间

PHP file_get_contents 设置超时时间

WBOY
WBOYOriginal
2016-06-23 13:15:211317browse

    $opts = array('http' =>

array(

'method'  => 'GET',

'timeout' => 3

)

);

$context  = stream_context_create($opts);

$url = "www.google.com";

$text = @file_get_contents($url,false,$context,-1,100);

if($text==FALSE){

 return FALSE;

}

return TRUE;


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn