Files
SunShineMusic/config.php
2025-09-24 14:15:03 +00:00

43 lines
1.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// 数据库配置文件
// 请根据你的虚拟主机信息填写正确内容
// 数据库服务器地址
$db_host = 'localhost'; // 大多数情况下是localhost部分主机可能需要特定IP
// 数据库用户名
// 注意:虚拟主机通常使用 "cpanel用户名_数据库用户名" 格式
$db_user = 'a1sax1m9i'; // 替换为你的实际数据库用户名
// 数据库密码
$db_pass = 'a1sax1m9i'; // 替换为你的实际数据库密码
// 数据库名称
// 注意:虚拟主机通常使用 "cpanel用户名_数据库名" 格式
$db_name = 'a1sax1m9i'; // 替换为你的实际数据库名称
// 创建数据库连接函数
function getDbConnection() {
global $db_host, $db_user, $db_pass, $db_name;
// 创建连接
$conn = new mysqli($db_host, $db_user, $db_pass, $db_name);
// 检查连接
if ($conn->connect_error) {
// 返回错误信息而非直接终止
return [
'success' => false,
'error' => '连接失败: ' . $conn->connect_error .
'<br>服务器: ' . $db_host .
'<br>用户名: ' . $db_user .
'<br>数据库: ' . $db_name
];
}
return [
'success' => true,
'connection' => $conn
];
}
?>