开发者社区 问答 正文

请教关于php的iconv编码转换问题

public function file_get(){
        $file = file_get_contents('Curl.html');
        iconv("ANSI", "UTF-8//IGNORE", $file);
        return empty($file) ? null : $file;
    }
}
header("Content-type: text/html; charset=utf-8");
$url = new mycurl();
$file = $url->file_get();
echo strip_tags($file);

Curl.html如下:
screenshot
输出如下:(乱码!)

Notice: iconv(): Wrong charset, conversion from ANSI' to UTF-8//IGNORE' is not allowed in D:xampphtdocsfunctionfunctioncURLcurl5.php on line 34
HTTP/1.1 200 OK Date: Mon, 03 Feb 2014 12:00:13 GMT Server: ATS/3.2.4 X-Powered-By: PHP/5.3.9 Vary: Accept

展开
收起
落地花开啦 2016-06-16 17:11:42 7831 分享 版权
1 条回答
写回答
取消 提交回答
  • 喜欢技术,喜欢努力的人

    $file = iconv("gbk", "UTF-8//IGNORE", $file);
    这样就OK了。

    2019-07-17 19:41:26
    赞同 展开评论
问答分类:
PHP
问答地址: