WebConfig.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. session_start();
  3. include_once("../../../untils/conn.php");
  4. mysqli_query($con, "set names utf8");
  5. $type = "web_config";
  6. $sql = "SELECT * FROM foundation WHERE type='$type'";
  7. $result = mysqli_query($con, $sql);
  8. // 构建 JSON 数据并输出给前端
  9. $data = array();
  10. if(mysqli_num_rows($result) > 0) {
  11. while($row = mysqli_fetch_assoc($result)) {
  12. $site_name = $row['site_name'];
  13. $site_seo = $row['site_seo'];
  14. $site_key = $row['site_key'];
  15. $site_ms = $row['site_ms'];
  16. $light_logo = $row['light_logo'];
  17. $dark_logo = $row['dark_logo'];
  18. $reuser = $row['reuser'];
  19. $loginuser = $row['loginuser'];
  20. $site_icp = $row['site_icp'];
  21. // 将数据添加到数据数组中
  22. $data["site_name"] = $site_name;
  23. $data["site_seo"] = $site_seo;
  24. $data["site_key"] = $site_key;
  25. $data["site_ms"] = $site_ms;
  26. $data["reuser"] = $reuser;
  27. $data["loginuser"] = $loginuser;
  28. $data["site_icp"] = $site_icp;
  29. }
  30. }
  31. // 将数据数组转换为 JSON 格式并输出
  32. echo json_encode($data);
  33. ?>