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

What to do if the php command line outputs garbled characters

藏色散人
Release: 2023-03-12 17:36:01
Original
3340 people have browsed it

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");
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template