codeigniter How to use the CI libraries and helper? Creating and calling a library

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

In order to use libraries in CodeIgniter, you need to create a library.

class Pro {
  function show_hello_world()
  {
    return 'Hello World';
  }
}

In this library, which is called is pro.php, this file must be added to the following path.

Path: \xampp\htdocs\project\application\libraries

Now you can use it in your controller. Code to load this library in the controller:

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

Code to use the library functions:

class Admin extends CI_Controller {
    function index()
    {
        $this->load->library('pro');
        echo $this->pro->show_hello_world();
    }
}


Got any codeigniter Question?