慕粉3413248
2016-12-30 22:44
操作:
public function index(){
$students = Student::paginate(3);
//echo "<pre>";
//var_dump($students);
return view('student.index',['student'=>$students]);
}
模板:
<div class = "pull-right" >
{{ $student->render() }}
</div>
报错:
ErrorException in Builder.php line 2093:Call to undefined method Illuminate\Database\Query\Builder::render() (View: D:\phpStudy\WWW\lara5.1\resources\views\student\index.blade.php)
解决了,在上面使用foreach的时候
@foreach($student as $student)这样写竟然会跟下面$student产生冲突,在foreach时@foreach($student as $val)就没事了,,不懂背后原理。。。
轻松学会Laravel-表单篇
32662 学习 · 255 问题
相似问题