Php ErrorException(E#u ERROR)rawurlencode()要求参数1为字符串,对象为给定的';
ErrorException(E_ERROR)rawurlencode()要求参数1为字符串,对象为' 我正在尝试显示两个表中的数据,并收到上面的错误消息,有人能帮助翻译此错误消息吗 这是控制器Php ErrorException(E#u ERROR)rawurlencode()要求参数1为字符串,对象为给定的';,php,laravel,Php,Laravel,ErrorException(E_ERROR)rawurlencode()要求参数1为字符串,对象为' 我正在尝试显示两个表中的数据,并收到上面的错误消息,有人能帮助翻译此错误消息吗 这是控制器 public function index() { $maintenances = DB::table('tenants')->select('tenants.lastname','tenants.firstname','maintenances.m_status','tenants.desi
public function index()
{
$maintenances = DB::table('tenants')->select('tenants.lastname','tenants.firstname','maintenances.m_status','tenants.designation', 'maintenances.description','maintenances.building_section','maintenances.category','maintenances.reported_date')
->join('maintenances','maintenances.tenants_id','=','tenants.id')
->get();
//dd($maintenances);
return view('agent/maintenance_list', compact('maintenances', 'assetTenants', 'tenants'));
}
和视图
@foreach($maintenances as $maintenance)
<tr>
<td class="text-center">
<div class="checkbox-custom">
<input id="product-01" type="checkbox" value="01">
<label for="product-01" class="pl-0"> </label>
</div>
</td>
<td>{{ $maintenance->designation }} {{ $maintenance->firstname }} {{ $maintenance->lastname }}</td>
<td>{{ $maintenance->category }}</td>
<td>{{ $maintenance->building_section }}</td>
<td>{{ $maintenance->description }}</td>
<td>{{ $maintenance->reported_date }}</td>
<td>{{ $maintenance->m_status }}</td>
<td class="text-center">
<div role="group" aria-label="Basic example" class="btn-group btn-group-sm">
<a href="{{ url('agent/edit_maintenance', $maintenance }}" type="button" class="btn btn-outline btn-success"><i class="ti-pencil"></i></a>
</div>
</td>
</tr>
@endforeach
此错误消息表示您的url正在路由某些内容,在本例中是从视图路由的。为了解决这个问题,下面的代码
<a href="{{ url('agent/edit_maintenance', $maintenance }}" type="button" class="btn btn-outline btn-success"><i class="ti-pencil"></i></a>
至于改成
<a href="{{ url('agent/edit_maintenance/'. $maintenance->id }}" type="button" class="btn btn-outline btn-success"><i class="ti-pencil"></i></a>
事实上,我们无法从远处神奇地读取您的代码。这不是它的工作原理。包括您的代码片段、错误消息。让我们看看你得到了什么,你已经尝试了什么?换句话说,采取行动。
<a href="{{ url('agent/edit_maintenance/'. $maintenance->id }}" type="button" class="btn btn-outline btn-success"><i class="ti-pencil"></i></a>