Home >Backend Development >PHP Problem >What to do if php passthru is garbled?
Solution to php passthru garbled code: 1. Run the corresponding php file; 2. Check the output "echo passthru("ipconfig");"; 3. Add "header("content- type:text/html;charset=gbk2312");" is enough.
The operating environment of this tutorial: Windows 7 system, PHP version 8.1, Dell G3 computer.
php passthru What should I do if the code is garbled?
php code to solve the problem of garbled characters
When using the passthru function of php, garbled characters appeared
Code:
<?php echo passthru("ipconfig"); ?>
Solution:
Add
header("content-type:text/html;charset=gbk2312");
charset in front of the original code - followed by the modified encoding
Code:
Recommended study: "PHP Video Tutorial"
The above is the detailed content of What to do if php passthru is garbled?. For more information, please follow other related articles on the PHP Chinese website!