从模型 yii2 中获取 table 名称
Get table name from model yii2
我想从 yii2 中的模型中获取 table 名称。
我试图调用下面的函数,但没有成功:
public static function tableName()
{
return '{{%user}}';
}
感谢您的帮助。
试试这个 -
ModelNameGoesHere::model()->tableSchema->name;
将 ModelNameGoesHere
替换为您的模型名称。
我想从 yii2 中的模型中获取 table 名称。
我试图调用下面的函数,但没有成功:
public static function tableName()
{
return '{{%user}}';
}
感谢您的帮助。
试试这个 -
ModelNameGoesHere::model()->tableSchema->name;
将 ModelNameGoesHere
替换为您的模型名称。