Home > PHP Framework > YII > Solution to garbled code problem in yii2 console

Solution to garbled code problem in yii2 console

藏色散人
Release: 2020-07-20 10:53:44
Original
2667 people have browsed it

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 garbled code problem in yii2 console

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";
Copy after login

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);
Copy after login

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!

Related labels:
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
Latest Issues
yii2 error connecting to mongodb3.2.4
From 1970-01-01 08:00:00
0
0
0
How to use mongodb to do rbac in yii2
From 1970-01-01 08:00:00
0
0
0
php - yii2-ueditor-widget
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template