php使用post方法说参数丢失

我正在使用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('irina@yahoo.com');


    //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';

}

邮递员截图:

http://img.mukewang.com/6349116a0001024c11880651.jpg

isThereParametersAvailable功能:


function isTheseParametersAvailable($params){


    foreach($params as $param){

        if(!isset($_POST[$param])){

            return false; 

        }

    }

    return true; 

}


天涯尽头无女友
浏览 202回答 1
1回答

摇曳的蔷薇

您必须发送参数是正文部分才能在 $_POST 中获取。见下图。<?php&nbsp;if(isset($_POST['header'])) {&nbsp; &nbsp; echo 1;}
打开App,查看更多内容
随时随地看视频慕课网APP