所以我试图将我的页面a.php链接到我的psql db。
这里是DBConnection.class.php:
<?php
class DBConnection
{
var $conn
function DBConnection();
{
$this->conn = pg_connect("host='localhost' port='5432' dbname='tester' user='postgres' password='password'") or die("unable to connect");
}
}
?>
和这里的a.php
<?php
include ("DBConnection.class.php");
$DBConnection = new DBConnection();
?>
它一直告诉我在DBConnection的第七行有一个错误:致命错误:非抽象方法DBConnection :: DBConnection()必须在第7行的C:\ wamp \ www \ DBConnection.class.php中包含body < / p>
我不完全确定我在解决这个问题方面做了什么
答案 0 :(得分:0)
Open php.ini
Find ;extension=php_pgsql.dll and remove the initial semi colon
Find ;extension=php_pdo_pgsql.dll and remove the initial semi colon
Save the file
Restart apache
删除
从函数名称的末尾开始
class DBConnection
{
var $conn
function DBConnection()
{
$this->conn = pg_connect("host='localhost' port='5432' dbname='tester' user='postgres' password='password'") or die("unable to connect");
}
}
?>