Home >Backend Development >PHP Problem >What should I do if the php verification code does not display characters?
The solution to the problem that the php verification code does not display characters: 1. Open the gd library; 2. Directly request the URL of the image; 3. Change the file to utf-8 encoding without BOM; 4. Add ob_clean() Just function.
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
What should I do if the php verification code does not display characters? ?
The verification code in php does not display the problem
1. First, you must make sure that your gd is turned on and there is no problem with your server
2. When your verification code does not display, you can directly request the URL of your image
Syntax error:
Logical error:
At this time, , if a syntax error occurs, the page will have corresponding prompts.
ButThere is no syntax error, only a black screen
Step2:Change header('Content -Type:image/jpeg')Comment and then you can find the error message again
Just solve !
3. The reason why the picture cannot be displayed: ExtraOutput
BOM:utf-8 signature of the encoded file, three bytes of hidden characters. is also output by ! You need to encode the file into utf-8 without BOM
4. If it doesn’t work at this time, then add an ob_clean(); to the header.
The role of ob_clean()
That’s it now
Finally found the problem, I hope it can help everyone
Recommended study: "PHP Video Tutorial"
The above is the detailed content of What should I do if the php verification code does not display characters?. For more information, please follow other related articles on the PHP Chinese website!