如何重定向页面和显示消息时,php错误上的编码器


How to redirect page and show message when php error on codeigniter?

我想重定向一个页面,然后在codeigniter上显示php错误时显示消息,如何做到这一点?

这里我的php 错误示例

遇到PHP错误严重性:错误消息:在null时调用成员函数GetToken()文件名:operator_pt/Profil_operatorpt.php行号:95回溯:

编辑:来自kuldeep的请求这里我的代码来自controller

public function testkoneksi()
    {
        $this->load->library('form_validation');
  $this->form_validation->set_rules('username','Username','trim|required');
  $this->form_validation->set_rules('password','Password','required');
  $this->form_validation->set_rules('url','URL','required');
        if($this->form_validation->run()===FALSE)
        {
            $this->session->set_flashdata('category_success', 'ISI DATA DENGAN BENAR.');
            redirect('operator_pt/profil_operatorpt', 'refresh');   
        }
        else
        {
        $this->load->helper('url');
        $this->load->library("Nusoap_lib");
        $url = $_POST["url"];
        //$url = 'http://localhost:8082/ws/live.php?wsdl';
        $client = new nusoap_client($url, true);
        $proxy = $client->getproxy();
        //mendapatkan token
        $username = $_POST["username"];
        $password = $_POST["password"];
        $url = $_POST["url"];
        $result=$proxy->GetToken($username, $password);
        $token = $result;
        if (isset($token)) {
    $this->session->set_flashdata('token_sukses', 'KONEKSI DENGAN FEEDER TELAH SUKSES.');
                redirect('operator_pt/profil_operatorpt', 'refresh');   
}
else $this->session->set_flashdata('token_gagal', 'KONEKSI DENGAN FEEDER GAGAL, CEK ULANG USERNAME, PASSWORD & URL-NYA.');
                redirect('operator_pt/profil_operatorpt', 'refresh');       
    }
}
$response = array('status' => true, 'message' => 'Error', 'redirect' => base_url() . 'Path to redirect');
            header('Content-Type:application/json');
            echo json_encode($response);

这可能有效。