1

I'm try to load and call some methods dicamicaly libraries in Codeigniter like

$plugins = array('paypal', 'captcha');
foreach($plugins as $plugin){
    $this->load->library($plugin);
    //The problem appear when I'm try to call some method...
    echo $this->[$plugin]->hello_world();
}
Garrett Kadillak
  • 1,026
  • 9
  • 18
joserico
  • 21
  • 1

2 Answers2

1

You can easily do it by following code. for more you can visit Codeigniter documentation

$this->load->library($plugin,null,'object_name');
$this->object_name->hello_world();

for remove instance of $this->object_name. better explanation here

unset($this->object_name);

or

$this->object_name = null;
-1

Try loading it in the autoload.php file of CI

CodeCanyon
  • 929
  • 2
  • 11
  • 36