• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.