Home > Backend Development > PHP Problem > What to do if cmd php is garbled?

What to do if cmd php is garbled?

藏色散人
Release: 2023-03-17 14:32:01
Original
1957 people have browsed it

Solution to cmd php garbled code: 1. In cmd or shellpower on the windows platform, execute the php script and check whether it is garbled; 2. Execute "exec("CHCP 65001");" in the php script. Just use the command to modify the character set of the current page number.

What to do if cmd php is garbled?

The operating environment of this tutorial: Windows 7 system, PHP version 8.1, Dell G3 computer.

What should I do if cmd php is garbled?

Use the command line to execute the php script and the output will be garbled

Today, when I execute the php script in cmd or shellpower on the Windows platform, the Chinese output will be garbled.

Modified the registry and also tried to modify the current page number CHCP 65001

But as soon as the php script is executed, the problem may occur again.

Finally came up with a solution, which is to execute the cmd command in the php script to modify the current page number character set

exec("CHCP 65001");
// coding...
Copy after login

Perfect solution

Recommended study: "PHP Video Tutorial

The above is the detailed content of What to do if cmd php is garbled?. 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