[英]Laravel: Redirect to a named route that has parameters in URL
誰能解釋我如何重定向到使用URL中的參數的命名路由?
我有以下代碼:
Route::put('{handle}', array(
'as' => 'section.update',
'uses' => 'Manneken\\Api\\SectionManager@update'
));
Route::post('{handle}', function()
{
if (Input::has('method') && Input::get('method') === 'PUT') {
Redirect::route('section.update', array(
'handle' => ''
))->withInput();
}
});
因此,我有一個使用PUT的路由,該路由的URL中有{handle}
,如果POST請求,我想重定向到該路由。 如何通過{handle}
?
好吧,我發現,我在閉包函數中缺少$handle
作為參數。
我必須說,很高興見到有用的Laravel社區在工作。 這里有很多對我有用的提示和技巧。 所有這些答案都讓我震驚,非常感謝!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.