Home >Backend Development >PHP Problem >What to do if the php command line outputs garbled characters
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 .
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!