gpt4 book ai didi

php - mysqli_connect() : php_network_getaddresses: getaddrinfo failed: Name or service not known

转载 作者:可可西里 更新时间:2023-11-01 13:28:05 25 4
gpt4 key购买 nike

我在一个主要使用数据库的网站上工作。问题是我收到以下错误:mysqli_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known我无法弄清楚如何解决它。我已经对连接进行了五次检查,似乎没问题。

function connect($hostname, $username, $password, $database)
{
$conid = mysqli_connect($hostname, $username, $password, TRUE);


if($conid == FALSE)
{
if(DEBUG == TRUE)
{
show_error("MySQL Connection using `$hostname`, `$username`, `$password` was refused");
}

return;
}

else
{
$dbid = mysqli_select_db($database, $conid);

if($dbid == FALSE)
{
if(DEBUG == TRUE)
{
show_error("MySQL could not connect to database `$database`");
}

return;
}

else
{
self::$connections[] = $conid;
self::$connection = $conid;
}
}
}

代码是在 2010 年编写的,然后以某种方式运行。可以修复吗?

最佳答案

这是服务器托管问题。您必须检查托管。

您还可以通过此链接阅读更多提示:http://albertech.net/2011/05/fix-php_network_getaddresses-getaddrinfo-failed-name-or-service-not-known/

关于php - mysqli_connect() : php_network_getaddresses: getaddrinfo failed: Name or service not known,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22946763/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com