久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網
      最全最豐富的資訊網站

      laravel怎么判斷是否是post傳輸

      在laravel中,可以利用Request對象的isMethod方法配合if語句來進行判斷是否是post傳輸請求,只需將參數設置為“post”即可,語法為“if($request->isMethod('post')){要執(zhí)行的代碼}”。

      laravel怎么判斷是否是post傳輸

      本文操作環(huán)境:Windows10系統(tǒng)、Laravel5.4版、Dell G3電腦。

      laravel怎么判斷是否post傳輸

      可以用post傳輸判斷form表單是否有值post傳過來:

      if($request->isMethod('post')){     // 要執(zhí)行的代碼 }

      通過 Request 對象的 isMethod 方法來進行判斷!

      示例如下:

      判斷是get還是post請求

      public function interview_add(Request $request,int $id){     if($request->isMethod('get')){         //get執(zhí)行的代碼     }elseif ($request->isMethod('post')){         //post執(zhí)行的代碼     } }

      擴展知識:

      PHP、laravel獲取post請求的params,xml,json

      獲取全部params

      //php原生寫法 $content = $_POST; //或者 $content = file_get_contents(“php://input”); //laravel寫法 $content = $request->all();

      獲取xml、json

      // 原生php寫法 $content = file_get_contents("php://input"); // laravel框架寫法 $content = $request->getcontent();

      贊(0)
      分享到: 更多 (0)
      網站地圖   滬ICP備18035694號-2    滬公網安備31011702889846號