更改URL想改變我的鏈接到一個更好的,例如:Laravel。爲更好的鏈接
此網址Route::get('/sections/{id}','[email protected]');
給我ADRESS laravel.dev/sections/1
。如何變更/1
到laravel.dev/sections/section_name
沒有htaccess的。可能嗎? Thx尋求幫助。
路線
Route::get('/sections/{section}','[email protected]');
控制器
public function show(Section $section)
{
$listSections = $section->user;
return view('sections.section', compact('listSections'));
}
查看
<a href="{{URL::to('/sections/'.$listSection->name)}}">{{$section->name}}</a>
只是改變路線,並通過SECTION_NAME代替身份證 –