我创建了一个新方法来处理401 apache错误.
我的核心类扩展了CI核心类,但是当我调用方法名时,我会收到以下消息:
致命错误:调用未定义的函数
show_401()在
G:\Path\application\controllers\loader.php上线29
class MI_Exceptions extends CI_Exceptions {
function __construct()
{
parent::__construct();
}
/**
* 401 Unauthorized
*
* @access private
* @param string the page
* @param bool log error yes/no
* @return string
*/
function show_401($page = '', $log_error = TRUE)
{
$heading = "401 Unauthorized";
$message = "Unauthorized.";
// By default we log this, but allow a dev to skip it
if ($log_error)
{
log_message('error', '401 Unauthorized --> '.$page);
}
echo $this->show_error($heading, …Run Code Online (Sandbox Code Playgroud)