Solved: PHP uses echo to output Chinese to the file log with garbled characters.

In my case, I want to redirect an output result to a file, php test.php > test.log Then look at the test.log situation, and then find Chinese garbled characters. Operation in phpstorm
Solution.

  1. echo mb_convert_encoding('中文','gbk','utf-8');
  2. iconv("GBK","UTF-8",'中文');

You can try both methods

Guess you like

Origin blog.csdn.net/qq_21891743/article/details/134284986