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 "只要显示这"; ?>
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(); }
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!

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

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version
Visual web development tools

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

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools