Codeigniter:检查配置变量是否已设置?

Wondering if there is a way to check if a config variable is set in Codeigniter?

if ( isset($this->config->item('configItem'))) {
//do stuff
}

Seems like something like this should work? The error I get is "Expected: variable".

Thoughts?

Are you loading your config file?

$this->config->load('configfilename'); 

If you are loading it then you should use:

if ( $this->config->item('configItem')) {
   //do stuff
}

The config class in CodeIgniter already handles the isset() and returns false if it can't find anything.

try this:

if ( isset($this->config->item('configItem'))&&($this->config->item('configItem')!='')) {
{
  //Proceed with your Code
}