配置
common/config/main-local.php
<?phpreturn [// ...'components' => [// ...'db' => ['class' => 'yii\db\Connection','dsn' => 'mysql:host=localhost;dbname=example','username' => 'root','password' => '','charset' => 'utf8','tablePrefix' => 'x_',// 可以让数据库字段的类型与取出的类型一致'attributes' => [PDO::ATTR_STRINGIFY_FETCHES => false,// 但是这一行可能引起异常PDO::ATTR_EMULATE_PREPARES => false]],],// ...];
