Home > Article > Backend Development > What should I do if the picture written in php does not display?
Solution to the problem that php writes pictures and does not display them: 1. Find and open the php.ini file; 2. Find "extension=php_gd2.dll" and remove the semicolon in front of it; 3. Restart Server; 4. Just clear the cache before drawing.
The operating environment of this tutorial: Windows 7 system, PHP version 8.1, Dell G3 computer.
What should I do if the picture written in php does not display?
The reason why pictures cannot be displayed in php drawing and its solution
In php drawing, you must first confirm whether the gd library is enabled. Go to the php.ini file and find extension=php_gd2.dll. Remove the previous; and restart the server.
If the normal picture is still not displayed in the drawing, it means that the server has incorrect picture information when replying to the request. Make sure Don’t put anything in front of , including html.
In addition, the picture is not displayed yet. Clear the cache before drawing (that is, before writing the header). First write ob_clean();
and then it can be displayed (including writing the file to download). Sometimes, if the file cannot be opened after downloading, you also need to clear the cache).
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of What should I do if the picture written in php does not display?. For more information, please follow other related articles on the PHP Chinese website!