【发布时间】:2021-08-03 19:04:39
【问题描述】:
我得到未定义的变量使用 Laravel 8 运行此代码
控制器
public function index(){
$customers =customers::all();
return view('welcome',["customers"=>$customers]);
}
Welcome.blade.php
@foreach ($customers as $customers)
<tr>
<td>{{ $customers->fullname }}</td>
<td>{{ $customers->phone }}</td>
<td>{{ $customers->item }}</td>
<td>{{ $customers->itemprice }}</td>
<td>{{ $customers->prepayment }}</td>
<td>{{ $customers->created_at }}</td>
<td>{{ $customers->updated_at }}</td>
</tr>
@endforeach
【问题讨论】:
-
欢迎来到 SO,我认为最好向我们展示您在尝试中遇到的错误以及您看到的输出。这对于社区更多地参与您的回答以解决您的问题很重要