╃巡洋艦㊣
- ╃巡洋艦㊣ 回答了问题 Yii2 ActiveRecord 追加条件
第一个问题:
可以使用andWhere()
追加查询条件。使用方法:$query = Post::find(); $query->where(['category' => $category]); $query->andWhere(['type' => $type]);
第二个问题:
时间的插入一般是在beforeSave()
中写入的。使用方法如下:public function beforeSave($insert) { if (parent::beforeSave($insert)) { if($insert) { $this->user_id = Yii::$app->user->id; $this->created_at = $this->updated_at = time(); } else { $this->updated_at = time(); } return true; } else { return false; } }
- ╃巡洋艦㊣ 回复了话题 解决 fgetcsv() 函数无法读取中文
很好的教程,仔细学习一下,如果在 Yii 中使用建议写到自己的 helper 类中。
- ╃巡洋艦㊣ 回答了问题 如何创建一个空项目?
提问者指定的是 1.1 版本,楼上回答有问题。
- ╃巡洋艦㊣ 2014-12-10 已签到连续签到9天,获得了20个金钱
- ╃巡洋艦㊣ 评论了教程 Yii 修改数据的两种方式
身为网站管理人员,格式都没调好。
- ╃巡洋艦㊣ 发表了说说Yii 2.0.1 发布了,详情请看网站最新动态。
- ╃巡洋艦㊣ 2014-12-09 已签到连续签到8天,获得了20个金钱
- ╃巡洋艦㊣ 2014-12-08 已签到连续签到7天,获得了20个金钱