[英]Why isn't an error being displayed?
So I'm in the process of connecting to a database. 因此,我正在连接数据库。 And here's my index.php
这是我的index.php
<?php
ini_set('display_errors', 1);
error_reporting(~0);
require_once 'core/init.php';
DB::getInstance();
?>
Followed by my init.php
其次是我的
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';
?>
Then followed by my DB.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;
}
}
Why is it that when I enter invalid credentials I don't get an error? 为什么当我输入无效的凭据时我没有收到错误消息? I'm working off of this video.
我正在制作这部影片。
将您的构造函数命名为__construct
,而不是__constuct
:-)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.