欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php-删除Json输出的引号

程序员文章站 2022-05-12 22:31:42
...
phpjsonandroid

删除json输出的双引号:
[{"id":"1","nom":"Magasin Jardins 2","ville":"Paris","latlng":["36.85715,10.127245"]}

latlng值:[36.85715,10.127245]

代码:

  $qry = "SELECT *FROM magasin";    $result = mysql_query($qry);  //  $promotions = array();    $response = array();    while($row = mysql_fetch_assoc($result)) {   // $promotions[]= $row; $magasin = array();        $magasin["id"] = $row["id"];        $magasin["nom"] = $row["nom"];        $magasin["ville"] = $row["ville"];        $lat = $row[latitude];        $long = $row[longitude];       $magasin["latlng"][] =floatval($lat).",".floatval($long);;  // push single product into final response array        array_push($response, $magasin);    }     mysql_close($con);  echo json_encode($response); 
相关标签: php json android