im创建一个Web服务,以便在激活警报时通过wialon警报sos通知接收单元ID,并通过请求发布方法将其发送到应用ip地址。
function init(){
var sess = wialon.core.Session.getInstance(); // get instance of current Session
// flags to specify what kind of data should be returned
var flags = wialon.item.Item.dataFlag.base | wialon.item.Unit.dataFlag.lastMessage | wialon.item.Unit.dataFlag.restricted;
sess.updateDataFlags(// load items to current session
[{type: "type", data: "avl_unit", flags: flags, mode: 0}], // Items specification
function (code) { // updateDataFlags callback
if (code) {
msg(wialon.core.Errors.getErrorText(code));
return;
} // exit if error code
// append option to select
var info = wialon.core.Session.getInstance().getItem("<?php echo $id; ?>"); // get unit by id
var pos = info.getPosition();
var uniqueid = info.getUniqueId();
var phonenumber = info.getPhoneNumber();
var time = wialon.util.DateTime.formatTime(pos.t);
var now = new Date(); // Conseguimos los datos de Ahora
var nowyear = now.getYear();
var nowmonth = now.getMonth();
var nowday = now.getDay(); // Que dia estamos
var nowhour = now.getHours(); // Hora actual
var nowminute = now.getMinutes(); // Minuto actual
var nowsecond = now.getSeconds(); // Segundo actual
var tiempo1 = new Date(nowyear, nowmonth, nowday, 0, 0, 0, 0);
var tiempo2 = new Date(nowyear, nowmonth, nowday, nowhour, nowminute, nowsecond, 0);
var dif = tiempo1.getTime() - tiempo2.getTime();
var Segundos_de_T1_a_T2 = dif / 1000;
var Segundos_entre_fechas = Math.abs(Segundos_de_T1_a_T2);
$("#unitlist").append("<p>P " + info.getName() + " " + phonenumber + " " + uniqueid + " " + "<?php echo $id; ?>" + " "+ Segundos_entre_fechas +" " + pos.x + " " + pos.y + " " + pos.s + "</p>");
}
);
}
但是我不知道如何通过php接收post变量(例如$ id = $ _ POST ['name'];) 有谁知道变量的命名方式或如何获取发布数据? 谢谢