Home  >  Article  >  Backend Development  >  What to do if php image output is garbled

What to do if php image output is garbled

藏色散人
藏色散人Original
2020-07-09 12:31:103382browse

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.

What to do if php image output is garbled

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!

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