发送自定义数据插件cordova php
这是在通知中发送消息和数据的代码发送自定义数据插件cordova php,php,cordova,phonegap-plugins,cordova-plugins,phonegap-pushplugin,Php,Cordova,Phonegap Plugins,Cordova Plugins,Phonegap Pushplugin,这是在通知中发送消息和数据的代码 $fields = array( 'registration_ids' => $this->devices, 'data' => array( "message" => $message, "msgcnt" => "8", "collapse_key" =>
$fields = array(
'registration_ids' => $this->devices,
'data' => array(
"message" => $message,
"msgcnt" => "8",
"collapse_key" => "dffbb")
);
我面临的问题是除了msgcnt
和collapse\u key
之外,我无法发送任何其他内容
例如,该警报提供未定义的警告
$fields = array(
'registration_ids' => $this->devices,
'data' => array(
"message" => $message,
"msgcnt" => "8",
"collapse_key" => "dffbb",
"test_field" => "test")
);
您可以使用以下自定义数据创建另一个数组:
$fields = array(
'registration_ids' => $this->devices,
'data' => array("message" => array("text_message" => $message, "test_field" => "test"),
"msgcnt"=>"8",
"collapse_key"=>"dffbb",
)
);
我知道了,返回的数据进入另一个名为payload的数组索引,所以如果您想用javascript访问它,可以尝试
alert(e.payload.test_field);
我改进了格式;然而,在例如…之后仍然有丢失的解释。。。请解释一下未定义的。什么是未定义的?