我正在使用file_get_contents
,我想要define a timeout。我試圖通過創建這樣的上下文來實現它:file_get_contents timeout
$timeout = array('http' => array('timeout' => 6));
$context = stream_context_create($timeout);
$xml = file_get_contents($hostName,false,$context);
但它忽略了這個值。
你怎麼能說它忽略了超時設置? – hakre 2012-04-17 10:13:50
在5.2.1中增加'timeout',檢查你的PHP版本。 – joar 2012-04-17 10:17:35
我給timeout賦了一個小值,儘管這個file_get_contents返回了好結果 – user1093588 2012-04-17 10:51:24