This paper analyzes the usage of $this->load->library () in CI framework. Share to everyone for your reference, specific as follows:
The first time I failed to load, originally is the file name and class name for different reasons, first summed up about CI loading your own class file considerations:
1. Third party loaded items should be placed under Application/libraries documents
2. FileName and class name should be the same, and the first letter uppercase, such as FileName excel.php class name should be Excel
3. Adoption:$this->load->library (' class '); The way to load where you need it
4. Can also be loaded in the application/config/autoload.php, add in the file
$autoload [' libraries '] = Array (' Excel ');
5. When loading, if libraries has more than one folder, such as myfile can be loaded in the following way:
$this->load->library (' myfile/class ');
6. The second parameter can be placed in the following way:
$config = Array (
' mailtype ' => ' html ', '
charset ' => ' utf-8,
' priority ' => ' 1 '
);
$this->load->library (' email ', $config);
7. The third parameter can use your custom name in the following way:
$this->load->library (' Session ', ', ' my_session ');
The session class can now be accessed in the following way:
$this->my_session->set_userdata ("Session name", "Session value");
More interested in CodeIgniter related content readers can view the site topics: "CodeIgniter Introductory Course", "CI (CodeIgniter) Framework Advanced Course", "PHP Excellent Development Framework Summary", "thinkphp Introductory Course", " Thinkphp Common Methods Summary, "Zend Framework Introduction Course", "PHP object-oriented Programming Introduction Course", "Php+mysql Database operation Introduction Tutorial" and "PHP common database Operation Skills Summary"
I hope this article will help you with the PHP program design based on CodeIgniter framework.