Khắc phục lỗi “PHP Fatal error: Uncaught TypeError: Argument 1 passed to CI_Exceptions::show_exception() must be an instance of Exception, instance of ParseError given” trong Codeigniter (ci)

15/07/2019 Nosomovo 0

1. Tình trạng lỗi Tôi sử dụng Codeigniter và xuất hiện lỗi sau. “PHP Fatal error: Uncaught TypeError: Argument 1 passed to CI_Exceptions::show_exception() must be an instance of Exception, instance of ParseError given” 2. Nguyên nhân Do hệ thống update từ php 5 lên php 7 php không còn hiểu

Sử dụng .htaccess loại bỏ “index.php” trong đường dẫn CodeIgniter – CI

07/03/2018 Nosomovo 0

Để loại bỏ “index.php” trong đường dẫn truy cập website ta tạo file .htaccess với nội dung sau: <IfModule mod_rewrite.c> RewriteEngine on RewriteCond $1 !^(index\.php|resources|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L,QSA] </IfModule> <IfModule !mod_rewrite.c> # Without mod_rewrite, route 404’s to the front controller ErrorDocument 404 /index.php

Không có ảnh

Cài đặt nơi lưu trữ session trong CodeIgniter – CI

06/03/2018 Nosomovo 0

CodeIgniter – Ci hỗ trợ 2 cách lưu trữ session là lưu trữ dạng file và lưu trữ trong databse. 1. Lữu trữ session dạng file: Trong file config.php (application/config/config.php) chúng ta chỉnh như sau: $config[‘sess_driver’] = ‘files’; //Hình thức lữu trữ session $config[‘sess_save_path’] =BASEPATH . ‘cache/sessions/’; //Đường dẫn lưu

Không có ảnh

Lấy kết quả của query insert trong CI

11/11/2017 Nosomovo 0

Bạn thực hiện một lệnh insert vào cơ sở dữ liệu và muốn kiểm tra trạng thái thêm có thành công hay không. Nhưng bạn chưa biết cách thực hiện. Đoạn code sau sẽ giúp bạn giải quyết vấn đề này nhé: return ($this->db->affected_rows() != 1) ? false : true;

Không có ảnh

Cấu hình base_url động trong CI

06/10/2017 Nosomovo 0

Để Ci nhận cấu hình base_url động theo giao thức và domain user truy cập, trong file config.php ta thay thế $config[‘base_url’] = ‘http://yourdomain’;  bởi đoạn sau: $protocol = (!empty($_SERVER[‘HTTPS’]) && $_SERVER[‘HTTPS’] !== ‘off’ || $_SERVER[‘SERVER_PORT’] == 443) ? “https://” : “http://”; $config[‘base_url’] = $protocol.$_SERVER[‘SERVER_NAME’]; Cái này hữu ích khi một