我正在使用curl來(lái)訪問(wèn) php 來(lái)執(zhí)行POST方法。問(wèn)題是使用該P(yáng)OST方法,if它不起作用,我得到參數(shù)丟失的錯(cuò)誤。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; }
php使用post方法說(shuō)參數(shù)丟失
天涯盡頭無(wú)女友
2022-10-14 15:35:48