Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/269.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 后台地理定位服务器将数据发布到服务器_Php - Fatal编程技术网

Php 后台地理定位服务器将数据发布到服务器

Php 后台地理定位服务器将数据发布到服务器,php,Php,嗨,伙计们,我正在使用背景地理定位插件,我正在向我的服务器php发送纬度和经度,我得到的数据如下 $data = file_get_contents('php://input'); 这是我的背景地理位置配置 backgroundGeolocation.configure(callbackFn, failureFn, { desiredAccuracy: 10, stationaryRadius: 20, distanceFilter: 30, url: 'http://192.168.

嗨,伙计们,我正在使用背景地理定位插件,我正在向我的服务器php发送纬度和经度,我得到的数据如下

    $data = file_get_contents('php://input');
这是我的背景地理位置配置

backgroundGeolocation.configure(callbackFn, failureFn, {
desiredAccuracy: 10,
stationaryRadius: 20,
distanceFilter: 30,
url: 'http://192.168.1.120/test.Php',
httpHeaders: { 'X-FOO': 'bar' },
maxLocations: 1000,
// Android only section
locationProvider: backgroundGeolocation.provider.ANDROID_ACTIVITY_PROVIDER,
interval: 60000,
fastestInterval: 5000,
activitiesInterval: 10000,
notificationTitle: 'Background tracking',
notificationText: 'enabled',
notificationIconColor: '#FEDD1E',
notificationIconLarge: 'mappointer_large',
notificationIconSmall: 'mappointer_small'
})

如何访问参数?我得到的数据是这样的

    $data = file_get_contents('php://input');
文件\u put\u contentstest.txt,$data get me:

[{"provider":"fused","time":1523431761125,"latitude":36.680000,"longitude":2.8007094,"accuracy":116.0999984741211,"locationProvider":1}]

我想得到alttitude和longitude如何使用php实现这一点

好的idk为什么在我发布问题后,我找到了答案lol,我使用了provider作为密钥这就是为什么没有工作xD反正我解决了它

 $array = json_decode($data, true);
$data=$array[0]['time']; // b

file_put_contents("tes2x.txt",$data);