CI_Loader::is_loaded()

is_loaded($class)

Parameters:
  • $class (string) – Class name
Returns:

Singleton property name if found, FALSE if not

Return type:

mixed

Allows you to check if a class has already been loaded or not.

Note

The word “class” here refers to libraries and drivers.

If the requested class has been loaded, the method returns its assigned name in the CI Super-object and FALSE if it’s not:

$this->load->library('form_validation');
$this->load->is_loaded('Form_validation');      // returns 'form_validation'

$this->load->is_loaded('Nonexistent_library');  // returns FALSE

Important

If you have more than one instance of a class (assigned to different properties), then the first one will be returned.

$this->load->library('form_validation', $config, 'fv');
$this->load->library('form_validation');

$this->load->is_loaded('Form_validation');      // returns 'fv'
doc_CodeIgniter
2016-10-15 16:31:44
Comments
Leave a Comment

Please login to continue.