19 lines
800 B
PHP
19 lines
800 B
PHP
<?php
|
|
header('Content-Type: text/html; charset=utf-8');
|
|
header('Access-Control-Allow-Origin: *');
|
|
header('Access-Control-Allow-Methods: GET, POST');
|
|
header('Access-Control-Allow-Headers: Content-Type');
|
|
header('Access-Control-Allow-Headers: Authorization');
|
|
header('Access-Control-Allow-Headers: X-Requested-With');
|
|
header("Content-Type: application/json"); // 返回 JSON 格式的响应
|
|
include_once "db_config.php";
|
|
$queryString = "select * FROM status";
|
|
$result = mysqli_query($conn, $queryString);
|
|
if(mysqli_num_rows($result) > 0){
|
|
$data = []; // 初始化为空数组
|
|
while ($row = mysqli_fetch_object($result)) { // 获取查询结果作为对象
|
|
$data[] = $row; // 将对象追加到数组中
|
|
}
|
|
echo substr(json_encode($data),1,58) ; // 输出 JSON 格式的响应
|
|
}
|