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

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

WBOY
Release: 2016-06-13 11:28:59
Original
873 people have browsed it

解决 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']);	}}
Copy after login
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