如何批量查询范围内的数据集

浏览:1132 发布日期:2017/07/11 分类:求助交流
用thinkphp5做一个数据表,url传递日期后,在value变量里遍历id,按照id顺序循环查询出数据库内的值。希望大神们教我怎么写这个遍历,我只能实现一个id的查询

控制层   
 public function read($date)
    {
        $value="1023,1024,1101,1026,1027";

        $vo=''; 
        $today['keshi'] = db('dept')->where('no',$vo)->column('name');
        $today['xianyou'] = db('dar_ip')->where('date',$date)->where('deptNo',$vo)->value('insidePer');
        $this->assign('today', $today);
    return $this->fetch();
        
    }
视图层                    <table id="list-table" class="table table-bordered table-striped">
                           <thead>
                               <tr>
                                      <th>科室</th>
                                     <th>现有人数</th>
                               </tr>
                            </thead>
                            <tbody>
                             {foreach name="today" item="vo"}
                              <tr role="row" align="center">
                                   <td>{$today.keshi}</td>
                             <td>{$today.xianyou}</td>
                               </tr>
                              {/foreach}
                            </tbody>
                    </table>
最佳答案
评论( 相关
后面还有条评论,点击查看>>