1、我用PDO读取数据库,会出现重复的数据,搞不懂是怎么来的。红线标出的部分都是重复的。
以下为数据库数据截图
以下为postman调取截图
2、PHP代码
`header("Content-Type:application/json;charset=UTF-8");
$pdo = new PDO("mysql:host=;dbname=GZMT","","");
$rs = $pdo -> query("select * from metro");
while($row = $rs -> fetchAll()){
$json = json_encode($row,JSON_UNESCAPED_UNICODE);
}
echo urldecode($json);`
ITer