Home > PHP Framework > ThinkPHP > What should I do if the thinkphp verification code does not display?

What should I do if the thinkphp verification code does not display?

爱喝马黛茶的安东尼
Release: 2019-08-22 13:54:59
Original
3420 people have browsed it

What should I do if the thinkphp verification code does not display?

The example in this article describes the perfect method to solve the problem of thinkphp verification code being unable to be displayed. Share it with everyone for your reference. The specific analysis is as follows:

The official tip is as follows:

If the verification code cannot be displayed, please check:
① Whether PHP has installed GD library support;
② Whether there is any before output The output (especially the BOM header information output of UTF8);
③ Whether the Image class library is imported correctly;
④ If it is a Chinese verification code, check whether the font file is copied to the directory where the class library is located.

Related recommendations: "ThinkPHP Tutorial"

But testing for half a day doesn’t work! I found a useful method on the Internet and put it into a file to execute. Enter tp through the index.php entry and enter the small A small x will appear, and verification codes will appear for other codes. The initial judgment is that there is content output before the verification code is output when tp is executed. I just thought of clearing the previous output.

Similar:

The code is as follows:

<?php  
ob_start();//不加这个是不行的(貌似不加可以)  
echo "不要显示";  
ob_end_clean();  
echo "只要显示这";  
?>
Copy after login

Solution, modify the method of generating verification code:

The code is as follows:

//生成验证码  
public function verifyimg(){  
import("ORG.Util.Image");  
ob_end_clean();  
Image::buildImageVerify();  
}
Copy after login

The above is the detailed content of What should I do if the thinkphp verification code does not display?. For more information, please follow other related articles on the PHP Chinese website!

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