首页 » 资源分享 » PHP » 正文

解决file_get_content抓取网页后乱码



当使用file_get_content抓取网页乱码,如一堆的����������,这个时候需要转一下码,代码示例:
$url = ‘http://www.xxxxx.com/news/1html’;
$html = file_get_contents($url);
$html = iconv(“gb2312”, “utf-8//IGNORE”,$html);