codeigniter

dompdf stream pdf in browser using localhost, but not in network ip

流过昼夜 提交于 2020-08-26 04:59:52
问题 i need to know why dompdf doesn't stream a pdf in browser before download on network ip like 192.168.1.77 , but it works on localhost. when using network ip, it just immediately download the file , it won't show pdf preview in browser i'm using dompdf version 0.6.2 this is my code $dompdf = new DOMPDF(); ob_start(); $this->load->view('report_me',array_merge($this->sesi,$this->session->userdata('printdata'))); // header('Pragma','public'); $html = ob_get_contents(); ob_end_clean(); // $this-

Codeigniter - re-populating form on failed validation after submitting

只愿长相守 提交于 2020-08-22 12:16:53
问题 I have a form that requires the user to enter some information. If they fail to complete the required fields they are re-presented with the form; the top of the page notifying them what fields are required and I've enabled sticky forms (set_value()) so their input is not lost. I'm using flashdata to display messages to the user (i.e., if what they've entered already exists in the database). My form is in the index method of my controller. When submit is clicked from my view it calls the add()

CodeIgniter - how to catch DB errors?

二次信任 提交于 2020-08-20 11:12:07
问题 Is there a way to make CI throw an exception when it encounters a DB error instead of displaying a message like: A Database Error Occurred Error Number: 1054 Unknown column 'foo' in 'where clause' SELECT * FROM ( FooBar ) WHERE foo = '1' NOTE: I only want this to happen in one controller. In the other controllers, I'm happy for it to display the DB error messages . 回答1: Try these CI functions $this->db->_error_message(); (mysql_error equivalent) $this->db->_error_number(); (mysql_errno

CodeIgniter - how to catch DB errors?

荒凉一梦 提交于 2020-08-20 11:11:59
问题 Is there a way to make CI throw an exception when it encounters a DB error instead of displaying a message like: A Database Error Occurred Error Number: 1054 Unknown column 'foo' in 'where clause' SELECT * FROM ( FooBar ) WHERE foo = '1' NOTE: I only want this to happen in one controller. In the other controllers, I'm happy for it to display the DB error messages . 回答1: Try these CI functions $this->db->_error_message(); (mysql_error equivalent) $this->db->_error_number(); (mysql_errno