我正在使用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';}邮递员截图:isThereParametersAvailable功能:function isTheseParametersAvailable($params){ foreach($params as $param){ if(!isset($_POST[$param])){ return false; } } return true; }
1 回答
摇曳的蔷薇
TA贡献1793条经验 获得超6个赞
您必须发送参数是正文部分才能在 $_POST 中获取。
见下图。
<?php
if(isset($_POST['header'])) {
echo 1;
}
- 1 回答
- 0 关注
- 187 浏览
添加回答
举报
0/150
提交
取消