代码部分:
hello.blade.php
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<style>
/* #p{
position: relative;
text-align:center;
} */
#juzhong{
text-align:center;
}
</style>
<!-- <h1>zhenshi</h1>
<h2>nihao</h2> -->
<!-- <div id='p'><p>学生信息</p></div> -->
<div id='juzhong'>
<table border="1">
<caption>学生信息</caption>
<thead>
<tr>
<th>编号</th>
<th>学号</th>
<th>姓名</th>
<th>年级</th>
<th>专业</th>
<th>专业编号</th>
<th>班级</th>
<th>学习形式</th>
<th>性别</th>
</tr>
</thead>
<tbody>
@foreach($student as $item)
<tr>
<td>{{$item['id']}}</td>
<td>{{$item['xh']}}</td>
<td>{{$item['xingming']}}</td>
<td>{{$item['nianji']}}</td>
<td>{{$item['zhuanye']}}</td>
<td>{{$item['zhuanyebianhao']}}</td>
<td>{{$item['banji']}}</td>
<td>{{$item['xuexixingshi']}}</td>
<td>{{$item['xingbie']}}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</body>
</html>
控制器:
public function index()
{
$student=$this->stu;
return view('hello',compact('student'));
//public $stu部分省略
}