Using CodeIgniter Libraries

Using CodeIgniter Libraries

All of the available libraries are located in your system/libraries/ directory. In most cases, to use one of these classes involves initializing it within a controller using the following initialization method:

$this->load->library('class_name');

Where ‘class_name’ is the name of the class you want to invoke. For example, to load the Form Validation Library you would do this:

$this->load->library('form_validation');

Once initialized you can use it as indicated in the user guide page corresponding to that class.

Additionally, multiple libraries can be loaded at the same time by passing an array of libraries to the load method.

Example:

$this->load->library(array('email', 'table'));

Creating Your Own Libraries

Please read the section of the user guide that discusses how to create your own libraries.

© 2014–2017 British Columbia Institute of Technology
Licensed under the MIT License.
https://www.codeigniter.com/user_guide/general/libraries.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部