Home > Article > Backend Development > What to do if php image output is garbled
Solution to garbled php image output: First open the corresponding file; then add the code statement "header("Content-Type:image/jpg");" to the head of the page. The statement is Used to declare the image type.
The picture displays garbled characters
Just add the following code to the head of the page, which is used to declare the picture type .
<?php header("Content-Type:image/jpg");//图片编码设置
For more related articles, please visit PHP Chinese website!
The above is the detailed content of What to do if php image output is garbled. For more information, please follow other related articles on the PHP Chinese website!