Home > PHP Framework > YII > body text

How to solve yii Chinese garbled characters

藏色散人
Release: 2020-07-22 11:48:37
original
3070 people have browsed it

Yii Chinese garbled solution: first find the database configuration file; then modify the code statement to "'dsn' => 'mysql:host=127.0.0.1; dbname=ohmycto; charset=utf8'," ;Finally save the changes.

How to solve yii Chinese garbled characters

About the Chinese garbled problem of yii2

Recommended: "yii tutorial"

Just configure it like this in the database configuration

 'yii\db\Connection',
    'dsn' => 'mysql:host=127.0.0.1; dbname=ohmycto; charset=utf8',
    'username' => 'website',
    'password' => 'mengde1B',
];
Copy after login

Simple summary:

If the database output is garbled, it is recommended to modify the character set when configuring the local data. For 'charset' => 'utf8mb4', or 'charset' => 'utf8', if there is a problem with the page, there may be a problem with the character encoding of your page. Yii2 defaults to UTF-8.

The above is the detailed content of How to solve yii Chinese garbled characters. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
yii
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 [email protected]
Latest issues
Popular Tutorials
More>
Latest downloads
More>
web effects
Website source code
Website materials
Front end template
About us Disclaimer Sitemap
PHP Chinese website:Public welfare online PHP training,Help PHP learners grow quickly!