file_get_contents 输出乱码问题
我的页面是utf-8,file_get_contents的页面是gb2312,输出时中文乱码。解决方法如下:
我的页面是utf-8,file_get_contents的页面是gb2312,输出时中文乱码。
解决方法如下:
解决方法如下:
<?php
header("Content-Type:text/html;charset=utf-8");
$keyworld="跟班网";
$keyworld=iconv("utf-8","gb2312",$keyworld);
$url = "http://www.baidu.com/s?f=8&wd=$keyworld";
$html = file_get_contents($url);
$html = iconv("gb2312", "utf-8//IGNORE",$html);
echo $html;
?> 特别声明:以上内容(如有图片或视频亦包括在内)为本平台用户上传并发布,本平台仅提供信息存储服务。举报




