wangjie404
- wangjie404 2016-05-23 已签到连续签到1天,获得了5个金钱
- wangjie404 回复了 wangjie404 的回答
可以在table_a 模型中写
getTable_b(){ return $this->hasOne(Model::CLASSNAME,['keyword'=keyword]) 或者hasMany() }
那就在b的模型中 写这个
getTable_a()
调用直接$model->table_a->
字段就可以 - wangjie404 回答了问题 随机查询出一条数据
rand(),id最好在数据里面 存在
- wangjie404 回答了问题 activeform关联查询
可以在table_a 模型中写
getTable_b(){ return $this->hasOne(Model::CLASSNAME,['keyword'=keyword]) 或者hasMany() }