Ajax请求检索Json

时间:2013-10-24 08:17:59

标签: php json laravel-4

我正在使用Laravel 4,我遇到以下问题。我发出了Ajax个请求,我有一个类GpsController,其函数名为GPSOnline

 public function GPSOnline () {
   $gpsonline=File::get( Config::get('app.driverspath'));
   $fstep = explode("|", $gpsonline);
   foreach($fstep as $k => $v){
      if(strlen($v)>0){
         $sstep [] = explode(",", $v);
      }
   }

   $array = array();
   foreach ($sstep as $v) {
     $tmp['ch'] = substr($v[0],0,1);
     $tmp['poz'] = substr($v[0],1);
     $tmp['la'] = $v[1];
     $tmp['lo'] = $v[2];
     $array[] = $tmp;
   } 

  // echo json_encode($array);
  return Response::json(array($array));
 }

但它不起作用。我的代码出了什么问题?!

0 个答案:

没有答案