以下内容似乎没有在windows中设置$_SERVER变量。
//Parse the properties
parse_ini_file("../../props/config.ini");
// Create a new PDO instanace
try {
$this->dbh = new PDO($dsn, $_SERVER['DB_USER'], $_SERVER['DB_PASS'], $options);
// Connection succeeded, set the boolean to true.
$this->dbcon = true;
} catch (PDOException $e) {
$this->error = $e->getMessage();
}
有人能帮我弄清楚吗。如果有任何帮助,我将不胜感激。
根据这个线程的建议,我成功地完成了这项工作。非常感谢大家。
以下是我所做的工作-
将parse_ini_file("..'..'props'config.ini");
更改为
$props = parse_ini_file("..'..'props'config.ini");
在$this->dbh = new PDO($dsn, $props['DB_USER'], $props['DB_PASS'], $options);
中将$_SERVER
替换为$props