我收到意外的异常。当我更新这样的数据:在PDO方法中找不到异常类
try {
$restaurantUpd = new Restaurant();
$restaurantUpd->updateRestaurant(array('restaurant_name' => Input::get('restaurant_name'),
'restaurant_location' => Input::get('restaurant_location'),
'restaurant_contact_email' => Input::get('restaurant_contact_email')
), $_GET['edit']);
//ok
} catch(Exception $e) {
die($e->getMessage());
}
它返回此错误: Warning: require_once(classes/Exeption.php): failed to open stream: No such file or directory in C:\xampp\htdocs\admintest\core\init.php on line 32
但奇怪的是我没有Exeption.php
类?此外,第32行是指我自动加载:
/*
* Autoload function for classes
*/
spl_autoload_register(function($class) {
require_once 'classes/' . $class . '.php';
});
在餐厅类我更新的方法是这样的...
public function updateRestaurant($fields = array(), $id = null) {
if (!$this->_db->update('rt_restaurant', $id, $fields, false)) {
throw new Exeption('There was a problem updating');
}
}
,并从DB类的更新方法PDO准备,执行,取
任何指导?
'Exeption'表明可能有一个错字 –
spl_autoload_register尝试需要一个文件,如果没有找到这个类,在你的程序中,它试图寻找异常类被称为在CATCH,也许你正在使用旧版本的PHP。请告诉您的PHP版本,并检查它是否有异常类... –
我的PHP版本ID是最新的... PHP版本5.4.22 – rZaaaa