티스토리 뷰

// Override show_404 method
function show_404(){
    // Load Router and Core classes.
    $RTR =& load_class('Router', 'core');

    // Get class and method for 404 from routes.php
    $x = explode('/', $RTR->routes['404_override']);
    $class = $x[0];
    $method = (isset($x[1]) ? $x[1] : 'index');

    // Get current class and method for callback
    $callback_class = $RTR->fetch_class();
    $callback_method = $RTR->fetch_method();
    // Can also log here, using callback class and method.

    // Create object for callback
    $CI = new $callback_class;
    call_user_func_array(array(&$CI, $method), array_slice(array($class,$method), 2));
} // End!
 function show_404($page = '', $log_error = TRUE)
{
    if ($log_error)
    {
        log_message('error', '404 Page Not Found --> '.$page);
    }
    redirect(base_url().index_page().'/controller/error_page');
           //OR
           //redirect('SOME URL');

    exit;
}


'웹개발 > Php' 카테고리의 다른 글

XDEBUG + WINcACHEgRIND 활용하기  (0) 2015.11.23
.htaccess 연구하기  (0) 2015.06.16
윈도우7 imagemagick 설치하기  (0) 2014.07.04
msgfmt 언어 컴파일 하기  (1) 2014.03.07
디자인 패턴 링크  (0) 2014.02.26
댓글
D-DAY
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함