The example in this article describes the automatic loading problem of classes in the CI framework. Share it with everyone for your reference, the details are as follows:
application/config
Add in configuration file:
| 1. Packages
| 2. Libraries
| 3. Helper files
| 4. Custom config files
| 5. Language files
| 6. Models
1. Third-party library file loading
// $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared'); $autoload['packages'] = array();
2. System class library loading
// $autoload['libraries'] = array('database', 'session', 'xmlrpc'); $autoload['libraries'] = array('database','session','form_validation','pagination','upload','curl','user_agent');
3. Help file loading
// $autoload['helper'] = array('url', 'file'); $autoload['helper'] = array('url','cookie','form','captcha','string','html','array','date','file','common');
4. Configuration file loading
// $autoload['config'] = array('config1', 'config2'); $autoload['config'] = array();
5. Language file loading
// $autoload['language'] = array('lang1', 'lang2'); $autoload['language'] = array();
6. Automatic loading of data model
//$autoload['model'] = array('model1', 'model2'); $autoload['model'] = array('');
Readers who are interested in more CodeIgniter related content can check out the special topics of this site: "codeigniter introductory tutorial", "CI (CodeIgniter) framework advanced tutorial", "php excellent development framework summary", "ThinkPHP introductory tutorial", "ThinkPHP Summary of common methods", "Zend FrameWork framework introductory tutorial", "php object-oriented programming introductory tutorial", "php+mysql database operation introductory tutorial" and "php common database operation skills summary"
I hope this article will be helpful to everyone’s PHP program design based on the CodeIgniter framework.