username = 'tiffinie'; $th-6ren">
gpt4 book ai didi

php getaddrinfo 失败 : "A non-recoverable error occurred during a database lookup."

转载 作者:行者123 更新时间:2023-11-29 05:21:10 25 4
gpt4 key购买 nike

非常感谢您的帮助:) 我在 PDO 连接上不断收到错误消息,例如:查找。

代码如下:

<?php
class Database{
public $dbserver = '';
public $username = '';
public $password = '';
public $database = '';
public $db = '';
public function __construct(){
$this->dbserver = 'localhost';
$this->username = 'tiffinie';
$this->password = 'pword';
$this->database = 'practicedb';
$this->db = new PDO("mysql:host=".$this->dbserver.";dbname=".$this->database, $this->username, $this->password);
}
public function dbselect($table, $select, $where=NULL){
}
public function dbadd($tablename, $insert, $format){
}
public function dbupdate($tablename, $insert, $where){
}
}
?>

最佳答案

托管您的应用的服务器可能不知道如何解析“localhost”。

参见 hosts为此提交文件。

您可以通过将“localhost”替换为“127.0.0.1”来解决这个问题

关于php getaddrinfo 失败 : "A non-recoverable error occurred during a database lookup.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25591831/

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