yii2 无法更新没有主键的表

提示如下:does not have a primary key. You should either define a primary key for the corresponding table or override the primaryKey() method

yii2 无法更新没有主键的表_第1张图片yii2 无法更新没有主键的表_第2张图片

我们需要去models进行设置:

/**

* 指定主键

* @return array|string[]

*/

public static function primaryKey()

{

return ['key'];

}

 文章地址:https://www.apizl.com/archives/view-148756-1.html

你可能感兴趣的:(Yii2)