这是我的ts文件
$path_to_firebase_cm = 'https://fcm.googleapis.com/fcm/send';
$token=array($token);
$fields = array(
'registration_ids' => $token,
'priority' => 10,
'data'=>$send_notification ,
'notification' => array('title' => $type_of_notification, 'body' => $title ,'sound'=>'Default'),
);
$headers = array(
'Authorization:key=' .'your server key' ,
'Content-Type:application/json'
);
// Open connection
$ch = curl_init('https://fcm.googleapis.com/fcm/send');
// Set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $path_to_firebase_cm);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
// Execute post
$result = curl_exec($ch);
// Close connection
curl_close($ch);
return $result;
当我每次运行app时显示Error:Uncaught(在promise中):TypeError:无法设置未定义的属性'items'