thinkphp 错误提示文字 乱码
先上图
错误提示的文字是乱码,不知道怎么回事,
提示是mysql错误,但mysql连接是正常的。数据库的编码和程序都是utf8的。网站前台显示正常,前台调出来的数据都是正常 的。就是登录的时候会出现这个错误,这个是用onethink搭的网站。
回复讨论(解决方案)
55行的代码
E(mysql_error());
贴出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); }}
你文件保存的编码也检查一下
这个报错页面html应该没有header指定编码,浏览器是根据你操作系统的默认语言解析的??gbk
文件编码 没有设置

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



What should I do if Google Chrome prompts that the content of this tab is being shared? When we use Google Chrome to open a new tab, we sometimes encounter a prompt that the content of this tab is being shared. So what is going on? Let this site provide users with a detailed introduction to the problem of Google Chrome prompting that the content of this tab is being shared. Google Chrome prompts that the content of this tab is being shared. Solution: 1. Open Google Chrome. You can see three dots in the upper right corner of the browser "Customize and control Google Chrome". Click the icon with the mouse to change the icon. 2. After clicking, the menu window of Google Chrome will pop up below, and the mouse will move to "More Tools"

If you encounter an error message when using your printer, such as the operation could not be completed (error 0x00000771), it may be because the printer has been disconnected. In this case, you can solve the problem through the following methods. In this article, we will discuss how to fix this issue on Windows 11/10 PC. The entire error message says: The operation could not be completed (error 0x0000771). The specified printer has been deleted. Fix 0x00000771 Printer Error on Windows PC To fix Printer Error the operation could not be completed (Error 0x0000771), the specified printer has been deleted on Windows 11/10 PC, follow this solution: Restart Print Spool

First, draw a circle in PPT, then insert a text box and enter text content. Finally, set the fill and outline of the text box to None to complete the production of circular pictures and text.

Table of Contents Solution 1 Solution 21. Delete the temporary files of Windows update 2. Repair damaged system files 3. View and modify registry entries 4. Turn off the network card IPv6 5. Run the WindowsUpdateTroubleshooter tool to repair 6. Turn off the firewall and other related anti-virus software. 7. Close the WidowsUpdate service. Solution 3 Solution 4 "0x8024401c" error occurs during Windows update on Huawei computers Symptom Problem Cause Solution Still not solved? Recently, the web server needs to be updated due to system vulnerabilities. After logging in to the server, the update prompts error code 0x8024401c. Solution 1

When we create Word documents on a daily basis, we sometimes need to add dots under certain words in the document, especially when there are test questions. To highlight this part of the content, the editor will share with you the tips on how to add dots to text in Word. I hope it can help you. 1. Open a blank word document. 2. For example, add dots under the words "How to add dots to text". 3. We first select the words "How to add dots to text" with the left mouse button. Note that if you want to add dots to that word in the future, you must first use the left button of the mouse to select which word. Today we are adding dots to these words, so we have chosen several words. Select these words, right-click, and click Font in the pop-up function box. 4. Then something like this will appear

To run the ThinkPHP project, you need to: install Composer; use Composer to create the project; enter the project directory and execute php bin/console serve; visit http://localhost:8000 to view the welcome page.

ThinkPHP has multiple versions designed for different PHP versions. Major versions include 3.2, 5.0, 5.1, and 6.0, while minor versions are used to fix bugs and provide new features. The latest stable version is ThinkPHP 6.0.16. When choosing a version, consider the PHP version, feature requirements, and community support. It is recommended to use the latest stable version for best performance and support.

The display error is a problem that may occur in the Xiangxiang Fuzhai app. Some users are not sure why the Xiangxiang Fuzhai app displays errors. It may be due to network connection problems, too many background programs, incorrect registration information, etc. Next, This is the editor’s introduction to how to solve app display errors for users. Interested users should come and take a look! Why does the Xiangxiang Fuzhai app display an error answer: network connection problem, too many background programs, incorrect registration information, etc. Details: 1. [Network problem] Solution: Check the device connection network status, reconnect or choose another network connection to use. Can. 2. [Too many background programs] Solution: Close other running programs and release the system, which can speed up the running of the software. 3. [Incorrect registration information
