Perfect solution thinkphp Verification Code error cannot display the method, thinkphp verification code
This article describes a perfect solution to the thinkphp verification code error cannot be displayed method. Share to everyone for your reference. The specific analysis is as follows:
Today to do verification code this piece, think of TP comes with the verification picture, Exultation, but Tinker half a day not come out, has been a small x look.
The official tips are as follows:
If the verification code cannot be displayed, please check:
①php has installed GD library support;
② outputs before output (especially UTF8 BOM header information output);
Whether the ③image class library is imported correctly;
④ If it is a Chinese code check if there is a copy font file to the directory where the library is located;
But a half-day test, no! Online to find a usable method, put in a file to execute the available, into the TP inside through the index.php entrance is a small x, and then can use the method where the file to change the code to utf-8 containing BOM code will also appear small x, other codes will come out of the verification code, The preliminary judgment is that TP executes to the output verification code before the content output, the supervisor thought of the output before the removal of the line.
Similar:
Copy the Code code as follows: <?php
Ob_start ();//Do not add this is not possible (seemingly do not add)
echo "Do not show";
Ob_end_clean ();
echo "just show this";
?>
Workaround, modify the Generate Captcha method:
Copy Code code as follows://Generate Verification code
Public Function verifyimg () {
Import ("ORG. Util.image ");
Ob_end_clean ();
Image::buildimageverify ();
}
It is hoped that this article is helpful to the PHP program design based on thinkphp framework.
http://www.bkjia.com/PHPjc/924542.html www.bkjia.com true http://www.bkjia.com/PHPjc/924542.html techarticle Perfect Solution thinkphp Verification Code error can not be displayed method, thinkphp verification Code This article describes the perfect solution thinkphp CAPTCHA error can not be displayed method. Share for everyone to join us ...