Home  >  Article  >  Backend Development  >  What to do if the php command line outputs garbled characters

What to do if the php command line outputs garbled characters

藏色散人
藏色散人Original
2021-09-18 10:35:403326browse

Solution to the garbled output of the php command line: 1. Add "header("content-type:text/html;charset=gbk");" to the php code; 2. Set the font of the command line .

What to do if the php command line outputs garbled characters

The operating environment of this article: Windows 7 system, PHP version 7.1, Dell G3 computer

What should I do if the php command line outputs garbled characters?

Handling Chinese character garbled output from the php command line under window

1. Add

    header("content-type:text/html;charset=gbk");

2. Set the font of the command line

Right-click the property font on the command line, select the following font, and click OK

I basically solved the problem according to the above process. If there are still garbled characters, check to see if it is. The encoding is not gbk, try gb2312 and some other encodings.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of What to do if the php command line outputs garbled characters. 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