21,886
社区成员
发帖
与我相关
我的任务
分享
$content=file_get_contents('http://bj.ganji.com/jiaoyou5/09032721_424301.htm');
$content=mb_convert_encoding($content,'gbk','utf-8');
echo $content;
header('Content-Type: text/html;charset=utf8');
date_default_timezone_set('Asia/Chongqing');
//中文
$content=file_get_contents('http://bj.ganji.com/jiaoyou5/09032721_424301.htm');
echo $content;exit;
<?
$content=file_get_contents('http://bj.ganji.com/jiaoyou5/09032721_424301.htm');
$content=mb_convert_encoding($content,'gbk','utf-8');
$content=str_replace('utf-8','gbk',$content);
echo $content;
?>
function getcontent($url)
{
$content=file_get_contents($url);
var_dump(strpos($content,'<html'));
if(!strpos($content,'<html')) getcontent($url);
else
{
//echo $content;
return $content;
}
}
$content=getcontent('http://bj.ganji.com/jiaoyou5/09032721_424301.htm');
echo $content;
$content=file_get_contents('http://bj.ganji.com/jiaoyou5/09032721_424301.htm');
echo $content;exit;