久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放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. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      laravel怎么判斷是否是post傳輸

      在laravel中,可以利用Request對(duì)象的isMethod方法配合if語(yǔ)句來(lái)進(jìn)行判斷是否是post傳輸請(qǐng)求,只需將參數(shù)設(shè)置為“post”即可,語(yǔ)法為“if($request->isMethod('post')){要執(zhí)行的代碼}”。

      laravel怎么判斷是否是post傳輸

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

      laravel怎么判斷是否post傳輸

      可以用post傳輸判斷form表單是否有值post傳過(guò)來(lái):

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

      通過(guò) Request 對(duì)象的 isMethod 方法來(lái)進(jìn)行判斷!

      示例如下:

      判斷是get還是post請(qǐng)求

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

      擴(kuò)展知識(shí):

      PHP、laravel獲取post請(qǐng)求的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)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)