PHP file_get_contents 设置超时时间
2016-03-03 16:46
447 查看
$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;
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;
相关文章推荐
- 一个关于if else容易迷惑的问题
- PHP5.2.*防止Hash冲突拒绝服务攻击的Patch
- 深入理解PHP之匿名函数
- JSP/PHP基于Ajax的分页功能实现
- 关于PHP通过PDO用中文条件查询MySQL的问题。
- 什么是设计模式
- PHP数据库长连接mysql_pconnect的细节
- Php Installing An Expansion
- PHP+Apache在Windows 9x下的安装和配置
- IIS 6 的 PHP 最佳配置方法
- 安装Apache和PHP的一些补充
- Linux Apache+MySQL+PHP
- 建立Apache+PHP+MySQL数据库驱动的动态网站
- GET和post取值限制区别分析
- PHP 5.3.0 安装分析心得
- sql2005 附加数据库出错(错误号:5123)解决方法
- apache 环境下 php 的配置注意事项
- C#中File类的文件操作方法详解
- 深入C#中get与set的详解