How to change the timezone in CodeIgniter 3.1.6

date_default_timezone_set() function is used to sets the default timezone used by all date or time functions in core PHP, CodeIgniter etc. date_default_timezone_set(); date_default_timezone_set('Asia/Kolkata'); # Option-1: In case of CodeIgniter, we can set the default timezone in the application/config.php file In case of CodeIgniter, we can set the default timezone in the application/config.php file <?php defined('BASEPATH') … Continue reading How to change the timezone in CodeIgniter 3.1.6

Download File in php or codeigniter

Want to download file using php. Here is the sample code. By using it you can download the file in php. you can use it in Codeigniter Also. the function are tested in Codeigniter. So it will works file in Codeigniter.  Just Call the function, download_sample(); It will start Downloading the file. public function download_sample(){ … Continue reading Download File in php or codeigniter

Php Code Encoding Benefits or which Encoder do I Need?

Php Code Encoding Benefits or which Encoder do I Need? Encoding Benefits PHP scripts can be easily read, changed and run on any PHP enabled system. Encoding PHP offers important benefits. Product Developers: protect and license your code before distribution. Time restricting is ideal for protecting evaluation copies, and server/domain based locking helps secure revenue from … Continue reading Php Code Encoding Benefits or which Encoder do I Need?

Download File in php

Download File in php function. Force Download. Here, $filepath = File Full path, where the file exists. $filename = File name of the file , which have to download ,LIKE: file1.txt header('Content-Description: File Transfer'); header('Content-Type: application/force-download'); header("Content-Disposition: attachment; filename=\"" . basename($filename) . "\";"); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize($filename)); ob_clean(); … Continue reading Download File in php

Undefined property $db in Codeigniter

Severity: Notice Message: Undefined property: CI::$db in codeigniter 3.16 Are you facing any notice saying Undefined property: Home::$db or something like this in your Codeigniter application? The reason behind the error Undefined property $db in Codeigniter arises because you didn’t load database library in your controller/method to use any function of it. This error also … Continue reading Undefined property $db in Codeigniter