How to set and get config item value in Codeigniter?

How to set and get config item value in Codeigniter?

In this post we will give you information about How to set and get config item value in Codeigniter?. Hear we will give you detail about How to set and get config item value in Codeigniter?And how to use it also give you demo for it if it is necessary.

Today, i would like to share with you how to set config item value in our codeigniter project. as well as i will share with you how to read that variable value that way we can use global variable in codeigniter 3 application.

We may need to define some global item like site url, site title, site meta data etc that way we can use it in our whole application. So here is very simple and basic example i am going to give you to define set and get config item value in Codeigniter 3 application.

we will use “$this->config” variable for set configuration item value. we will use “set_item()” and “item()” method for set and get value of array key.

So let’s see very basic and simple example for config file item value.

Set Config Value:

$this->config->set_item('mainURL','onlinecode');

Get Config Value:

$mainURL = $this->config->item('mainURL');

Example Config Value:

Also see:Codeigniter 3 Datatables Ajax Example From Scratch

$this->config->set_item('mainURL','onlinecode');


$mainURL = $this->config->item('mainURL');


print_r($mainURL);

exit;

I hope it can help you….

Hope this code and post will helped you for implement How to set and get config item value in Codeigniter?. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

2  +  1  =  

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US