getAll($sql); for($i=0;$igetRow($accountsql); $result[$i]['name']= $accountinfo['name']; $result[$i]['tel']= $accountinfo['tel']; //最新位置时间 $upload_time=strtotime($result[$i]['upload_time']); $firstchoose_time=date('Y-m-d H:m:s',$upload_time-86400*3); $location_logsql="SELECT distinct(latitude) as lat,longitude as lng from location_log where account_id='$account_id' and upload_time>'$firstchoose_time' limit 0,5"; $location_loginffo=$conn->getAll($location_logsql); // $chooseloginfo=[]; // for($j=0;$j0){ //// $chooselenth=$chooselenth+1; //// $chooseloginfo[$chooselenth]=$location_loginffo[$j]; //// } // $chooseloginfo[$chooselenth]=$location_loginffo[$j]; // // } $result[$i]['guiji']= $location_loginffo; } echo json_encode($result); } } catch (Exception $e) { die($e->getMessage()); }