我有 3 个类名“ Controller ”、“ Loader ”、“ Error ”和“ Ex_controller ”。
“控制器.php ”
class Controller
{
function __Construct()
{
$this->load = Loader::getinstant();
$this->error = $this->load->class('Error');
}
}
“加载器.php ”
class Loader
{
function class($class)
{
require_once($class);
return new $class;
}
}
“错误.php ”
class Error
{
function query($query)
{
$res = mysql_query($query)
if($res)
{
return $res;
}else{
die('Could not execute query: '.mysql_error().'at line '. __LINE__ .
' in file ' . __FILE__);//does it work?If it doesn't, how to
make it work?
}
}
}
“ Ex_controller.php ”
class Ex_controller extends Controller
{
function __Construct()
{
parent::__construct();
$result = $this->error->query('some sql query');//(*)
}
}
如何使用 (*)显示Ex_controller中发生错误的位置?