工作,我有一個問題,在laravel路由參數, 這裏是main.blade.php:路由參數不laravel
<body>
<div class="flex-center position-ref full-height">
<div class="content">
<div class="title m-b-md">
Generate Your Domain Now
</div>
{!! Form::open(['route'=>'generatorindex' , 'method' => 'post']) !!}
<input type="hidden" name="_token" value="{!! csrf_token() !!}">
<input name="inputkeyword" type="text" placeholder="Enter your keyword">
<button type="submit" value="Generate"></button>
{!! Form::close() !!}
</div>
</div>
</body>
,這裏是在控制器的功能:
public function generator(Request $inputkeyword)
{
echo $productname = $inputkeyword->input('inputkeyword');
}
最後,這裏是路線:
Route::any('/generator/{inputkeyword}', [ 'as' => 'generatorindex', 'uses' => '[email protected]' ]);
但它返回:
ErrorException in UrlGenerationException.php line 17:
Missing required parameters for [Route: generatorindex] [URI: generator/{inputkeyword}]. (View: C:\Users\Mostafa\myapp\resources\views\main.blade.php)
我在做什麼錯?我應該在哪裏定義inputkeyword參數?
查看路線,你必須定義d/generator/{inputkeyword}像這樣,但是在表單提交中,您只傳遞了generatorindex,所以請發送generatorindex/paremeter {id} – Sona