Home >Backend Development >PHP Tutorial >Analysis on the solution to the problem that the verification code is not displayed in thinkphp, onethink and thinkox, thinkphpthinkox_PHP tutorial
This article explains the solution to the problem that the verification code is not displayed in thinkphp, onethink and thinkox. Share it with everyone for your reference, the details are as follows:
When using the verification code, it worked fine at first, but then it stopped showing up
On the Internet, it is said that it is a UTF-8 encoding problem. What BOM should be removed and converted into a BOM-free format?
I tried everything, but it didn’t work
Later I found out that I wrote
where the verification code is called.Public function verify(){ import('ORG.Util.Image'); Image::buildImageVerify(); }
Just change it to this:
Public function verify(){ import('ORG.Util.Image'); ob_clean();//这个就是关键 Image::buildImageVerify(); }
The purpose of the ob_clean function is to discard the content in the output buffer. If your website has many generated image files, you need to clear the buffer frequently if you want to access them correctly.
Readers who are interested in more thinkPHP-related content can check out the special topics on this site: "Introduction to ThinkPHP Tutorial", "Summary of Common Methods of ThinkPHP", "Summary of Cookie Usage in PHP", "Basic Tutorial for Getting Started with Smarty Templates" and "PHP Template technology summary".
I hope this article will be helpful to everyone’s PHP programming based on the ThinkPHP framework.