旧版服务端

This commit is contained in:
tianmo committed 2026-09-29 13:39:36 +08:00
1 parent 3429c8b402
commit 25bbb5f9c8
971 files changed
+87141 -40

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
<?php
// 连接数据库
// 引用配置,建立数据库连接
require_once 'ApiConfig.php';
$conn = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
// 检查连接是否成功
if ($conn->connect_error) {
die("连接失败: " . $conn->connect_error);
}
// 构建SQL查询语句
$sql = "SELECT * FROM cloudconfig ORDER BY ID ASC";
// 执行查询
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// 将结果转换为关联数组
$data = $result->fetch_all(MYSQLI_ASSOC);
// 输出JSON数据
header('Content-Type: application/json');
echo json_encode($data);
} else {
// 如果没有匹配的数据
header('Content-Type: application/json');
echo json_encode(array('message' => '没有找到匹配的数据'));
}
// 关闭数据库连接
$conn->close();
?>