Welcome Guest, Not a member yet? Register   Sign In
How to access $config array
#1

[eluser]Unknown[/eluser]
Hello,

I'm trying to get value which set at config.php from my controller:
Code:
$config['base_url'] = "http://localhost/ci/";

Now I do it like this:
Code:
$this->config->config['base_url']

Is there any better way instead specifying 'config' twice?

Thanks
#2

[eluser]theprodigy[/eluser]
According to the Config Class Docs:
Code:
$this->config->item('item name');
#3

[eluser]Unknown[/eluser]
True, thank you very much
#4

[eluser]Atharva[/eluser]
you can use
Code:
base_url()
function to get base_url set in config.php
#5

[eluser]Aken[/eluser]
Alternatively, config_item('item') is available globally without loading any additional resources.




Theme © iAndrew 2016 - Forum software by © MyBB