• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Autoload Libraries (from CI3)

#1
In CI3:

config/autoload.php

PHP Code:
$autoload['libraries'] = array('test_lib'); 

controller/Test.php

PHP Code:
class Test extends CI_Controller
{

 
   public function index()
 
   {
 
       echo $this->CI->test_lib->variable;

 
       $this->CI->test_lib->method();
 
   }




The library was connected automatically, access to it was in any part of the project.


How to make it so that in CI4 was like this:

PHP Code:
class Test extends CI_Controller
{

 
   public function index()
 
   {
 
       echo TestLib->variable;

 
       TestLib->method();
 
   }


Reply


Messages In This Thread
Autoload Libraries (from CI3) - by Alex1Strakhov - 10-12-2018, 01:46 AM
RE: Autoload Libraries (from CI3) - by InsiteFX - 10-12-2018, 03:13 AM
RE: Autoload Libraries (from CI3) - by titounnes - 10-12-2018, 08:31 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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