1.控制器中

$list = Userlawsbook::where($where)->with('lawsbook')->paginate(7);  // 此处查出来为数组对象

dump[0]['lawsbook']; // 可直接打印出第一个关联的对象

2.模型中

public function lawsbook()
{
return $this->belongsTo('app\common\model\china\Lawsbook', 'china_lawsbook_id', 'id', [], 'LEFT')->setEagerlyType(0);  // 关联模型
}

3.模板中输出

{volist name="list" >下载</a>
</li>
{/volist}

 

相关文章:

  • 2022-12-23
  • 2021-07-14
  • 2021-12-10
  • 2022-01-16
  • 2022-01-19
  • 2021-08-12
  • 2022-12-23
猜你喜欢
  • 2021-05-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案