Yii framework Chinese garbled solution:
1. The default encoding of Editplus may be ANSI, which needs to be changed to UTF-8.
Click "Tools"
Select "Configuration User Tools"
In the window that opens , select "File"
Select the encoding method of the default encoding, as shown in the figure, select "utf-8", then click Confirm, exit the software, and then open the new default i.e. It is in utf-8 format
2. Configure it like this in the database configuration:
<?php return [ 'class' => 'yii\db\Connection', 'dsn' => 'mysql:host=127.0.0.1; dbname=ohmycto; charset=utf8', 'username' => 'website', 'password' => 'mengde1B', ];
Recommended related articles and tutorials: yii tutorial
The above is the detailed content of How to solve Chinese garbled characters in yii framework. For more information, please follow other related articles on the PHP Chinese website!