Home >Backend Development >PHP Problem >What to do if cmd php is garbled?
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.
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...
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!