Home  >  Article  >  PHP Framework  >  How to solve Chinese garbled characters in yii framework

How to solve Chinese garbled characters in yii framework

尚
Original
2019-12-23 16:02:082761browse

How to solve Chinese garbled characters in yii framework

Yii framework Chinese garbled solution:

1. The default encoding of Editplus may be ANSI, which needs to be changed to UTF-8.

Click "Tools"

How to solve Chinese garbled characters in yii framework

Select "Configuration User Tools"

How to solve Chinese garbled characters in yii framework

In the window that opens , select "File"

How to solve Chinese garbled characters in yii framework

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

How to solve Chinese garbled characters in yii framework

2. Configure it like this in the database configuration:

<?php

return [
    &#39;class&#39; => &#39;yii\db\Connection&#39;,
    &#39;dsn&#39; => &#39;mysql:host=127.0.0.1; dbname=ohmycto; charset=utf8&#39;,
    &#39;username&#39; => &#39;website&#39;,
    &#39;password&#39; => &#39;mengde1B&#39;,
];

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!

Statement:
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