解决方法
1.更改配置,关闭mysql严格模式
common/config/main-local.php
增加on afterOpen 配置
// Mysql部分的配置
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=127.0.0.1;dbname=fecmall',
'username' => 'root',
'password' => '123456',
'charset' => 'utf8',
'on afterOpen' => function ($event) {
$event->sender->createCommand("set session sql_mode = 'NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES'")->execute();
}
],
2.重写该查询
3.等新版本优化