我可以通过这种方式从数据库中获取数据;
$con = mysqli_connect("localhost","root","root","demo");
$sql = "Select value From Users WHERE name in ('username', 'surname', 'age')";
$result = mysqli_query($con,$sql);
if(mysqli_num_rows($result) > 0 ){
while ($row = mysqli_fetch_assoc($result)) {
echo $row["value"];
}
}
mysqli_close($con);
输出:
JohnWick42
如何在json中获取此数据
示例json输出:
{"result":[{
"username":"John",
"surname":"Wick",
"age":"42"
}
]}
感谢。