newjz
- newjz 赞了回答
在模型里重写tableName()方法,如:
public static function tableName() { return 动态表名; }
也没试过,不知道行不行
- newjz 赞了回答
function tableName()
- newjz 回答了问题 yii2 模型 有动态 表名的功能吗?
搞定:
模型
public static $table='';
public static function tableName(){ return self::$table; }
控制器
$price= new RebarPrice();
$price::$table='t_rebar_price2017';
$price=$price::findOne(['id'=>1]); - newjz 提出了问题yii2 模型 有动态 表名的功能吗?
- newjz 2017-07-12 已签到连续签到1天,获得了5个金钱
- newjz 2017-07-06 已签到连续签到1天,获得了5个金钱
- newjz 2017-07-04 已签到连续签到1天,获得了5个金钱
- newjz 2017-07-02 已签到连续签到1天,获得了5个金钱
- newjz 2017-06-30 已签到连续签到5天,获得了20个金钱