2017-08-14 119 views

回答

1

選項1

可以這種方式結合GETPOST方法有一個路線:

Route::match(array('GET','POST'),'/route','[email protected]_function'); 

選項2

或者您可以使用此替代:

Route::any('/route', '[email protected]_function'); 

和控制器/功能中,您可以檢查方法的名稱是這樣的:

if (Request::isMethod('post')) 
{ 
// ... this is POST method 
} 
if (Request::isMethod('get')) 
{ 
// ... this is GET method 
} 
+0

使用'array()'沒有意義。 '[]'語法較短。 –

+0

是的!它是你的偏好。 –

+0

適用於我的情況 – murugesh