如何在codeigniter上的php错误时重定向页面并显示消息?

时间:2016-08-16 10:36:15

标签: php codeigniter redirect handle

我想重定向页面,然后在codeigniter上显示php错误时显示一条消息,该怎么做?

这里我的php 错误示例

  

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

编辑:来自kuldep的请求 这里是我来自控制器的代码

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');       
    }
}

0 个答案:

没有答案