thinkphp5.1 关联查询多表查询

2018-12-01T18:02:00

控制器代码:

<?php

$goods_rs=Db::name('goods')
->field('a.id,a.title,b.sid,b.price')
->alias('a')
->join('goodsPic b','a.id = b.sid')
->where('a.pid',$rs['sid'])
->where('a.flid',2)
->select();
$this->assign('goods_rs',$goods_rs);

模版代码:

 <div class="layui-form-item">
    {volist name=&quot;goods_rs&quot; id=&quot;goods&quot;} 
   <div class="layui-inline"> 
    <label class="layui-form-label">{$goods.title}</label> 
    <div class="layui-input-inline"> 
     <input type="hidden" name="sid2[]" value="{$goods.id}" /> 
     <input name="price[]" lay-verify="required" autocomplete="off" class="layui-input" type="text" value="{$goods.price}" /> 
    </div> {/volist} 
   </div> 
当前页面是本站的「Baidu MIP」版。发表评论请点击:完整版 »