我创建了我的RESTful mysql后端一切都很好除了我的 feteched查询有问题。我的意思是,当我返回的json超过2个对象时,它没有显示任何内容。 我正在使用ionic3 / http。
我的select.php:
$sql = "SELECT * FROM products ORDER BY id";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
$data = array() ;
while($row = $result->fetch_assoc()) {
$data[] = $row;
}
echo json_encode($data);
} else {
echo "0";
}
我的离子服务文件:
getProducts(){
return this.http.get("http://localhost/api/products/select.php")
.map(res=>{
this.checkMe = res;
if(this.checkMe._body !== "0"){
return res.json()
}
} );
}
我真的需要你的帮助。 谢谢大家。
答案 0 :(得分:0)
你试过吗..
{{1}}
答案 1 :(得分:0)
我在MySQL的某个字段中有 html标记,它停止了json_encode()操作。
谢谢大家