【发布时间】:2020-11-22 15:21:46
【问题描述】:
我的控制器
public function total_record()
{
$tailor_measurement = DB::select('select count(*) from tailor_measurement ');
return view('total record', ['tailor_measurement' => $tailor_measurement]);
}
我的浏览总记录
<!DOCTYPE html>
<html>
<head>
<title>Total Records</title>
</head>
<body>
@foreach($tailor_measurement as $row)
{{$row}}
@endforeach
</body>
</html>
它给我错误 htmlspecialchars() 期望参数 1 是字符串,给定对象(视图:C:\wamp64\www\shaban\resources\views\total record.blade.php)
【问题讨论】:
-
$row是一个对象,因此您不能直接在模板中显示它。 -
@Jeto 比我怎么显示?