Home > Backend Development > PHP Tutorial > php-删除Json输出的引号

php-删除Json输出的引号

WBOY
Release: 2016-06-02 11:34:48
Original
1660 people have browsed it

phpjsonandroid

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

latlng值:[36.85715,10.127245]

代码:

<code>  $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); </code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template