first commit
This commit is contained in:
18
Web/imasBackend/test.php
Normal file
18
Web/imasBackend/test.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?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 格式的响应
|
||||
}
|
Reference in New Issue
Block a user