Articles → PHP CODEIGNITER → Create A Custom Library In Codeigniter
Create A Custom Library In Codeigniter
Example
 
- Create a new file inside the "libraries" folder.
- The name of the file is "MyLib.php" (you can give any name).
- Write the following code inside the file "MyLib.php"
<?php
class MyLib
{
    public function MyFunc()
    {
        echo "Calling MyFunc";
    }
}
- Now call the class inside the controller using the following code
$this->load->library('mylib');
$this->mylib->MyFunc();
Click to Enlarge
| Posted By  - | Karan Gupta | 
|  | 
| Posted On  - | Friday, July 24, 2020 |