xupengfei
- xupengfei 2017-06-06 已签到连续签到1天,获得了5个金钱
- xupengfei 2017-05-19 已签到连续签到1天,获得了5个金钱
- xupengfei 2017-05-02 已签到连续签到1天,获得了5个金钱
- xupengfei 2017-04-28 已签到连续签到1天,获得了5个金钱
- xupengfei 赞了回答
假设你的日志模型类是MyLog
class MyLog extends \yii\db\ActiveRecord { private static $tableName = ''; public static function initTableName($date) { self::$tableName = 'log_' . $date; } public static function tableName() { return self::$tableName; } } /*使用的时候先根据日期初始化表名*/ $date = date('Ymd'); MyLog::initTableName($date); /*以下代码按照正常使用即可*/ /*获取实例*/ $model = new MyLog(); /*查询*/ MyLog::find()->where()->........
- xupengfei 赞了回答
这种情况直接DAO 不就好了,或者做成 动态Model , log_201701xx 这种