嗨,我正在学习如何设置搜索表单的教程,但出现route
错误(NotFoundHttpException
)。
形式
{!! Form::open(['method'=>'GET' ,'url' => 'search', 'class'=>'form-group main-form', 'id'=>'search-form', 'role'=>'form']) !!}
{{ csrf_field() }}
<div style="display:none"><input name="utf8" type="hidden" value="✓"></div>
<input class="form-group main-form" id="q_objname_en_cont" name="searchKey" placeholder='Search by Job title' required="required" style="height:40px;width:60%" type="search">
<input class="btn btn-warning" type="submit" value="Search">
{!! Form::close() !!}
路线
//Search route(get)
Route::get('search/{searchkey}', 'EmploiController@search')->where('searchkey', '[A-Za-z]+')->name('search');
网址(浏览器)
http://localhost:8000/search?_token=LJpgN3AwCFoDElOkFsSOX8BBLU1IFOzMvUYiokQj&utf8=%E2%9C%93&searchKey=quia