【发布时间】:2019-05-28 02:17:48
【问题描述】:
在页面上的我的 Laravel 脚本中出现此错误:
“遇到非数字值(查看:/home/grammer/public_html/test/core/resources/views/admin/apiServices.blade.php)”
对于这一行
<td>{{ $key+1 }}</td>
我的页面代码:
@extends('admin.layouts.master')
@section('page_icon', 'fa fa-suitcase')
@section('page_name', 'API Services')
@section('body')
<div class="row">
<div class="col-md-12">
<div class="tile">
<h3 class="tile-title">API Services List</h3>
<table class="table table-hover">
<thead>
<tr>
<th>Serial</th>
<th>Service ID</th>
<th>Name</th>
<th>Category</th>
<th>Price</th>
<th>Min</th>
<th>Max</th>
</tr>
</thead>
<tbody>
@foreach($items as $key => $item)
<tr>
<td>{{ $key+1 }}</td>
<td>{{ isset($item->service->id) ? $item->service->id : $item->service}}</td>
<td>{{ $item->name }}</td>
<td>{{ $item->category }}</td>
<td>{{ isset($item->rate) ? $item->rate : $item->price_per_k }} $</td>
<td>{{ $item->min }}</td>
<td>{{ $item->max }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@endsection
【问题讨论】:
-
你定义的行是什么
$items? -
在这个页面中,我们可以看到一个站点服务及其api,项目是站点中的服务