我创建了一个用于显示数据库数据的视图表单刀片模板。现在运行脚本显示foreach循环的致命错误,当我通过@endforeach结束foreach循环时,将是什么解决方案
<!DOCTYPE html>
<html>
<head>
<title>All userinfo</title>
<link rel="stylesheet" type="text/css" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<div class="row col-md-6 col-md-offset-2 custyle">
<table class="table table-striped custab">
<thead>
<a href="userinfo/create" class="btn btn-primary btn-xs pull-right"><b>+</b> Add new categories</a>
<tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
<th>Age</th>
<th>Hometown</th>
<th class="text-center">Action</th>
</tr>
</thead>
foreach($alldata as $data)
<tr>
<td>{{ $data -> id }}</td>
<td>{{ $data -> name }}</td>
<td>{{ $data -> email }}</td>
<td>{{ $data -> age }}</td>
<td>{{ $data -> hometown }}</td>
<td class="text-center"><a class='btn btn-info btn-xs' href="#"><span class="glyphicon glyphicon-edit"></span> Edit</a> <a href="#" class="btn btn-danger btn-xs"><span class="glyphicon glyphicon-remove"></span> Del</a></td>
</tr>
@endforeach
</table>
</div>
</div>
</body>
</html>
答案 0 :(得分:4)
您忘记了@
:
@foreach($alldata as $data)