Home  >  Article  >  Backend Development  >  一小段PHP代码求解解决方案

一小段PHP代码求解解决方案

WBOY
WBOYOriginal
2016-06-13 13:40:41733browse

一小段PHP代码求解

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->

<?php $eurl = mb_convert_encoding("一",'utf8','gb2312');

echo $eurl;
?>




目的就是把中文转换成utf8编码,怎么试了试不行呢

------解决方案--------------------
iconv第三个参数是字符串。而你传了数组。$s = iconv('gbk', 'utf-8', $s['old_text']);
------解决方案--------------------
$s = mysql_fetch_array($query);
$s = iconv('gbk', 'utf-8', $s['old_text']);

另外请确认你从数据库读出的内容是 gbk 编码的
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