mysql
xxsl
123456
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
数据库增删改
新增 使用model::save()操作进行新增数据 $user= new User; $user->username =$username; $user->password =$password; $user->save() 使用createCommand()进行新增数据 Yii::$app->db->createCommand()->insert('u转载 2017-09-08 14:56:54 · 350 阅读 · 0 评论 -
数据查询 --where
条件查询 $customers = Customer::find()->where($cond)->all(); $cond就是我们所谓的条件,条件的写法也根据查询数据的不同存在差异,那么如何用yii2的方式来写查询条件呢? [[简单条件]] // SQL: (type = 1) AND (status = 2). $cond = ['type' => 1,转载 2017-09-08 14:55:17 · 322 阅读 · 0 评论 -
yii2 配置多个数据库链接
在vendor\yiisoft\yii2\base\Application.php 中加入以下代码: public function getMallDb() { return $this->get('mallDb'); } 在vendor\yiisoft\yii2\db\ActiveRecord.php 中加入以下代码: public static function原创 2018-01-19 17:45:42 · 1529 阅读 · 0 评论
分享