Home  >  Article  >  Backend Development  >  php 使用curl 中文乱码问题

php 使用curl 中文乱码问题

WBOY
WBOYOriginal
2016-06-23 13:50:071716browse

在使用php语言做 服务器端重定向时可能会出现中文乱码问题?

解决方法也是很简单的:

 $contents= file_get_contents('http://www.yitire.com/'); // 获取 页面内容 $en_contents=mb_convert_encoding($contents, 'UTF-8', 'UTF-8,GBK,GB2312,BIG5');  // 对页面内容进行编码

这种服务器端跳转有个不好的地方是:不能传递session 和cookie ,不过也有相应的方法解决。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn