您可以使用该json_encode函数将本机PHP数组或stdClass对象转换为相应的JSON表示:
$result = $db->query('SOME QUERY');
$set = array();
if($result->num_rows) {
while($row = $result->fetch_array()) {
$set[] = $row;
}
}
echo json_encode($set);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1636 次 |
| 最近记录: |