Home  >  Article  >  Backend Development  >  解决 ThinkPHP URL 中文乱码有关问题

解决 ThinkPHP URL 中文乱码有关问题

WBOY
WBOYOriginal
2016-06-13 11:28:59864browse

解决 ThinkPHP URL 中文乱码问题
参考:
http://www.thinkphp.cn/code/121.html
http://www.glmynet.com/index.php/blog/39

用URL提交请求有中文时,无法插入到数据库中(数据库是utf-8)。
可通过iconv来转换中文编码为utf-8再插入。

if (!mb_check_encoding($_REQUEST['error'], 'utf-8')){	$error = iconv('big5', 'utf-8', $_REQUEST['error']);        if (!$error) {		$error = iconv('gbk', 'utf-8', $_REQUEST['error']);	}}
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