我在我的网站上使用了whoops,现在我尝试让它与 PDO 错误一起工作,当缺少连接到数据库的信息时它可以正常工作,但是当你(例如)键入一个不存在的表时,它不会' t 显示错误。
我试图添加PrettyPageHandler::addDataTable()
到我的错误处理中
数据库.php
class db {
// just some not important code here...
// Try to get the result from database.
try {
$pdo = DB::getInstance()->db->prepare($sql);
$pdo->execute($execute);
$result = $pdo->fetchAll(PDO::FETCH_ASSOC);
// Return Result
return $result;
}
catch(PDOException $e)
{
PrettyPageHandler::addDataTable(null, $e);
}
}
索引.php
<?php
if(file_exists("plugins/whoops/autoload.php"))
{
require_once 'plugins/whoops/autoload.php';
$whoops = new \Whoops\Run;
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
$whoops->register();
}
require_once db.php';
$db = new db();
但后来我得到一个找不到类'PrettyPageHandler'