Home  >  Article  >  Backend Development  >  What should I do if the PHP verification code image does not display the image?

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

藏色散人
藏色散人Original
2020-10-29 10:16:172574browse

The solution to the problem that the php verification code picture does not display the picture: first check whether php has the gd extension installed; then find the php.ini file in the php directory; finally change the file encoding method to utf-8 without DOM format. And just clear the cache before the header.

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

Recommended: "PHP Video Tutorial"

PHP Image Verification Code Solution that cannot be displayed

Problem: Use php to implement image verification code, the page does not display

登录

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

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

Solution:

In the windows environment, check whether the gd extension is installed in php and it is enabled

          Find the php.ini file in the php directory and look for the following statements Semicolon, remove the semicolon

Change the file encoding method to utf-8 DOM-less format

Clear the cache before the header

ob_clean();
 
header('Content-Type: image/png');

echo, print_r cannot appear before output, var_dump etc. print, comment or delete

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

Statement:
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