Home > PHP Framework > YII > body text

Solution to garbled code problem in yii2 console

藏色散人
Release: 2020-07-20 10:53:44
Original
2566 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:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!