Home > Backend Development > PHP Tutorial > thinkphp 错误提示文字 乱码

thinkphp 错误提示文字 乱码

WBOY
Release: 2016-06-23 13:56:45
Original
1344 people have browsed it



先上图
错误提示的文字是乱码,不知道怎么回事,

提示是mysql错误,但mysql连接是正常的。数据库的编码和程序都是utf8的。网站前台显示正常,前台调出来的数据都是正常 的。就是登录的时候会出现这个错误,这个是用onethink搭的网站。


回复讨论(解决方案)

55行的代码 

 E(mysql_error());
Copy after login

贴出login控制器代码

贴出login控制器代码


<?php// +----------------------------------------------------------------------// | OneThink [ WE CAN DO IT JUST THINK IT ]// +----------------------------------------------------------------------// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.// +----------------------------------------------------------------------// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>// +----------------------------------------------------------------------namespace Admin\Controller;use User\Api\UserApi as UserApi;/** * 后台首页控制器 * @author 麦当苗儿 <zuojiazi@vip.qq.com> */class PublicController extends \Think\Controller {    /**     * 后台用户登录     * @author 麦当苗儿 <zuojiazi@vip.qq.com>     */    public function login($username = null, $password = null, $verify = null){        if(IS_POST){            /* 检测验证码 TODO: */            if(!check_verify($verify)){                $this->error('验证码输入错误!');            }            /* 调用UC登录接口登录 */            $User = new UserApi;            $uid = $User->login($username, $password);            if(0 < $uid){ //UC登录成功                /* 登录用户 */                $Member = D('Member');                if($Member->login($uid)){ //登录用户                    //TODO:跳转到登录前页面                    $this->success('登录成功!', U('Index/index'));                } else {                    $this->error($Member->getError());                }            } else { //登录失败                switch($uid) {                    case -1: $error = '用户不存在或被禁用!'; break; //系统级别禁用                    case -2: $error = '密码错误!'; break;                    default: $error = '未知错误!'; break; // 0-接口参数错误(调试阶段使用)                }                $this->error($error);            }        } else {            if(is_login()){                $this->redirect('Index/index');            }else{				/* 读取数据库中的配置 */				$config	=	S('DB_CONFIG_DATA');				if(!$config){					$config	=	D('Config')->lists();					S('DB_CONFIG_DATA',$config);				}				C($config); //添加配置				                $this->display();            }        }    }    /* 退出登录 */    public function logout(){        if(is_login()){            D('Member')->logout();			session('[destroy]');            $this->success('退出成功!', U('login'));        } else {            $this->redirect('login');        }    }    public function verify(){        $verify = new \COM\Verify();        $verify->entry(1);    }}
Copy after login

你文件保存的编码也检查一下

这个报错页面html应该没有header指定编码,浏览器是根据你操作系统的默认语言解析的??gbk

文件编码 没有设置

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