为什么不显示错误?

时间:2014-04-28 18:40:52

标签: php

所以我正在连接数据库。这是我的index.php

<?php
ini_set('display_errors', 1);
error_reporting(~0);
require_once 'core/init.php';
DB::getInstance();
?>

关注我的init.php

<?php
session_start();
$GLOBALS['config'] = array(
'mysql' => array(
    'host' => '127.0.0.1',
    'username' => 'root',
    'password' => '*',
    'db' => 's'
    ), 
'remember' => array(
    'cookie_name' => 'hash',
    'cookie_expiry' => '604800'

    ),
'session' => array(
'session_name' => 'user' 
));

spl_autoload_register(function($class){
require_once 'classes/'. $class.'.php';

});
require_once 'functions/sanitize.php';

?>

然后是我的DB.php

<?php
class DB {
private static $_instance = null;
private $_pdo,
        $_query, 
        $_error = false, 
        $_results,
        $_count = 0;


private function __constuct(){
    try{
        $this->_pdo = new PDO('mysql:host='. Config::get('mysql/host').';dbname='.Config::get('mysql/db'),Config::get('mysql/username'),Config::get('mysql/password'));
    }catch(PDOException $e){
        die($e->getMessage());
    }
}       
public static function getInstance(){
    if(!isset(self::$_instance)){
        self::$_instance = new DB();
    }
    return self::$_instance;

}
}

为什么当我输入无效凭据时,我不会收到错误?我正在处理this视频。

1 个答案:

答案 0 :(得分:0)

为您的构造函数__construct命名,而不是__constuct: - )