In the earlier posts we learned about how to create baseurl, custom library, sending email in Codeigniter. Now we can learn about how to read the config file data in the complete application of Codeigniter. It is very tiny but useful when we need to use any variable in several times in the application.
Below I have taken the example variables which I have taken in send emails using HTML templates in Codeigniter
$config['smtp_port'] = 25;
$config['smtp_user'] = 'SMTP Username';
$config['smtp_pass'] = 'SMTP Password';
In your controller files or in view page we can directly access it by below code
By this we can access these variables through out the application of Codeigniter. If you want to change any any value then change it in config file that will reflect entire application. It looks simple but we need implement it for huge application then debugging will be easy.