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

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

WBOY
Release: 2016-06-13 10:14:39
Original
836 people have browsed it

一小段PHP代码求解

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?php $eurl = mb_convert_encoding("一",'utf8','gb2312');echo $eurl;?>
Copy after login


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

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

另外请确认你从数据库读出的内容是 gbk 编码的
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template