CI_Exceptions::show_404 PHP Method

show_404() public method

404 Error Handler
public show_404 ( string $page = '', boolean $log_error = TRUE ) : void
$page string Page URI
$log_error boolean Whether to log the error
return void
    public function show_404($page = '', $log_error = TRUE)
    {
        if (is_cli()) {
            $heading = 'Not Found';
            $message = 'The controller/method pair you requested was not found.';
        } else {
            $heading = '404 Page Not Found';
            $message = 'The page you requested was not found.';
        }
        // By default we log this, but allow a dev to skip it
        if ($log_error) {
            log_message('error', $heading . ': ' . $page);
        }
        echo $this->show_error($heading, $message, 'error_404', 404);
        exit(4);
        // EXIT_UNKNOWN_FILE
    }

Usage Example

 function show_404($page = '', $log_error = TRUE)
 {
     if (trim($page) == '') {
         $page = $_SERVER['REQUEST_URI'];
     }
     return parent::show_404($page, $log_error);
 }
All Usage Examples Of CI_Exceptions::show_404