<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<h2>详细信息</h2>
@if(empty($item))
没有信息
@else
<div>
{{$item['xh']}}
{{$item['xingming']}}
{{$item['zhuanye']}}
{{$item['banji']}}
{{$item['xingbie']}}
</div>
@endif
</body>
</html>
<div class="container">
<div class="row">
<table class="table table-striped table-hover">
<caption>学生名单</caption>
<thead>
<tr>
<td>编号</td><td>学号</td><td>姓名</td><td>专业</td><td>班级</td><td>性别</td>
</tr>
</thead>
<tbody>
@foreach($student as $item)
<!-- @if ($loop->index%2)
<tr class="bgcolor">
@else
<tr>
@endif -->
<tr>
<td>{{$item['id']}}</td>
<td>{{$item['xh']}}</td>
<td>
<!-- href="http://www.zz.com/user/{{$item['xh']}}"
href="{{url('user/'.$item['xh'])}}"-->
<a href="{{route('user.show',$item['xh'])}}" >
{{$item['xingming']}}
</a>
</td>
<td>{{$item['zhuanye']}} </td>
<td>{{$item['banji']}} </td>
<td>{{$item['xingbie']}}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
<style type="text/css">
.bgcolor{
background-color:lightgreen;
}
</style>
</body>
$student=Student::$stu;
$item=null;
foreach($student as $value){
if ($id==$value['xh']) {
// code...
$item=$value;