2017-08-14 118 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