简体   繁体   中英

set status header not working

set status header shows a blank page.

$this->output->set_status_header('404');

My complete code in codeigniter 3.1.8 and php 7.1

public function oops()
{
    $this->output->set_status_header('404');
    //$this->last_set_status_code = '404';
    //header("HTTP/1.1 404 Not Found");
    //$this->load->view('oops');
    redirect(base_url(),'refresh');
}

To show_404 -

 <?php
    class MY_Exceptions extends CI_Exceptions {

        public function show_404()
        {
            $CI =& get_instance();
            $CI->load->view('my_notfound_view');
            echo $CI->output->get_output();
            exit;
        }
  }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM