file_get_contents 输出乱码问题
我的页面是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;
?> 声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
- 上一篇:没有了
- 下一篇:没有了
