亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

php使用post方法說參數丟失

php使用post方法說參數丟失

PHP
天涯盡頭無女友 2022-10-14 15:35:48
我正在使用curl來訪問 php 來執行POST方法。問題是使用該POST方法,if它不起作用,我得到參數丟失的錯誤。php代碼:if(isTheseParametersAvailable(array('title','email', 'message'))){if(isset($_POST['title']) and isset($_POST['message'])){        //creating a new push        //if the push don't have an image give null in place of image        $push = new Push(                $_POST['title'],                $_POST['message'],                null            );    //getting the push from push object    $mPushNotification = $push->getPush();     //getting the token from database object      echo $devicetoken = $db->getTokenByEmail('[email protected]');    //creating firebase class object     $firebase = new Firebase();     //sending push notification and displaying result     echo $firebase->send($devicetoken, $mPushNotification);}else{    $response['error']=true;    $response['message']='Parameters missing';}郵遞員截圖:isThereParametersAvailable功能:function isTheseParametersAvailable($params){    foreach($params as $param){        if(!isset($_POST[$param])){            return false;         }    }    return true; }
查看完整描述

1 回答

?
搖曳的薔薇

TA貢獻1793條經驗 獲得超6個贊

您必須發送參數是正文部分才能在 $_POST 中獲取。

見下圖。

http://img1.sycdn.imooc.com//6349117d000163c811100433.jpg

<?php 



if(isset($_POST['header'])) {

    echo 1;

}


查看完整回答
反對 回復 2022-10-14
  • 1 回答
  • 0 關注
  • 242 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號