Home > Article > PHP Framework > Solution to garbled code problem in yii2 console
yii2 The solution to console garbled characters: first find and open the corresponding script file; then modify the code statement to "$content = iconv("utf-8","gb2312//IGNORE",$content); ”; finally save the changes.
Solution to the problem of Chinese garbled characters normally encountered on the cmd command prompt when Yii2 console executes a scheduled script [Version 2.0]
Specific question:
$content="你好,世界"; $content = iconv("utf-8","gb2312//IGNORE",$content); echo $content . "\n";
Normally the method we use is this:$data=iconv("GB2312", "UTF-8",$string);
Filtering errors Yes: //IGNORE
Recommended: "yii tutorial"
##Correct usage :
$content = iconv("utf-8","gb2312//IGNORE",$content);
The above is the detailed content of Solution to garbled code problem in yii2 console. For more information, please follow other related articles on the PHP Chinese website!