Check if request is GET or POST

后端 未结 6 1226
离开以前
离开以前 2021-02-04 23:37

In my controller/action:

if(!empty($_POST))
{
    if(Auth::attempt(Input::get(\'data\')))
    {
        return Redirect::intended();
    }
    else
    {
                


        
6条回答
  •  爱一瞬间的悲伤
    2021-02-05 00:20

    According to Laravels docs, there's a Request method to check it, so you could just do:

    $method = Request::method();
    

    or

    if (Request::isMethod('post'))
    {
    // 
    }
    

提交回复
热议问题