//禁止缓存
header("Expires:Mon,26Jul199705:00:00GMT");
header("Pragma:no-cache");
//设置编码
header("Content-Type:text/html;charset=utf-8");
//获取远程文件内容
function readtemp($tempurl){
$opts=array('http'=>array('method'=>'GET','timeout'=>500));
$context=stream_context_create($opts); //创建输入流
@$temphtml=file_get_contents($tempurl,false,$context) or die("文件不存在:".$tempurl);
return $temphtml;
}
//输出内容
echo <span style="font-family: Arial, Helvetica, sans-serif;">readtemp('http://xxx.com');</span>file_get_contents 多参数
最新推荐文章于 2025-08-27 08:40:21 发布
本文介绍了一段PHP代码,用于从指定URL读取文件内容并以utf-8编码输出。
1954

被折叠的 条评论
为什么被折叠?



