<h1 style="text-align: center;">学生信息</h1><table align="center" border=1;><tr><th>编号</th><th>学号</th><th>姓名</th><th>专业</th><th>班级</th><th>性别</th></tr>@foreach ($students as $item)<tr align="center" ><td>{{$item['id']}}</td><td>{{$item['xh']}}</td><td>{{$item['xingming']}}</td><td>{{$item['zhuanye']}}</td><td>{{$item['banji']}}</td><td>{{$item['xingbie']}}</td></tr>@endforeach
第二块代码:
public function index(){$students=$this->students;$id=null;$xingming =null;$xh = null;$zhuanye=null;$xingbie=null;$banji=null;$data = compact('students','id','xingming','xh','zhuanye','xingbie','banji');return view('info',$data);//}