致命错误:未捕获错误:调用未定义的方法Connection :: prepare

时间:2017-05-27 20:18:25

标签: php

我的连接类:

class Connection{

private $host="localhost";
private $user="root";
private $password="";
private $dbname="test";         

private function conectionDB(){
    $conn = new PDO("mysql:host=$this->host;dbname=$this->dbname","$this->user", "$this->password");
    return $conn;           
}

public function __contruct(){
    return $this->conectionDB();           
}
}

我的index.php:

 <?php   
require_once('class/Connection.class.php');
$pdo_conn = new Connection();
$query = "select * from qualquercoisa"
$pdo_statement = $pdo_conn->prepare($query);

 ?>

错误: 致命错误:未捕获错误:调用未定义的方法Connection :: prepare()

0 个答案:

没有答案