Home > php教程 > php手册 > 解决 ThinkPHP URL 中文乱码问题

解决 ThinkPHP URL 中文乱码问题

WBOY
Release: 2016-06-07 11:45:15
Original
1337 people have browsed it

解决 ThinkPHP URL 中文乱码问题
将GetcodingBehavior.class.php放入/Lib/Behavior中
/Conf/tags.php 加入 "app_begin" => array("Getcoding"),/**<br>  * $_GET 编码 解决url中文问题<br>  * @author Administrator<br>  *<br>  */<br> class GetcodingBehavior extends Behavior{<br>     public function run(&$params) {<br>         <br>         foreach ($_GET as $k=>$v){<br>             if(!is_array($v)){<br>                 if (!mb_check_encoding($v, 'utf-8')){<br>                     $_GET[$k] = iconv('gbk', 'utf-8', $v);<br>                 }<br>             }else{<br>                 foreach ($_GET['_URL_'] as $key=>$value){<br>                     if (!mb_check_encoding($value, 'utf-8')){<br>                         $_GET['_URL_'][$key] = iconv('gbk', 'utf-8', $value);<br>                     }<br>                 }<br>             }<br>         }<br>         <br>     }<br> }

AD:真正免费,域名+虚机+企业邮箱=0元

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template