CodeIgniter Interview Questions and Answers

CodeIgniter is the best PHP framework. It is very easy to use and very lightweight. The CodeIgniter can be used to develop any kind of web project from small website to large scale of application. Here is the list of most popular and most asked CodeIgniter Interview Questions with Answers for both beginners and experienced PHP programmers.

1. What is CodeIgniter ?

Codeigniter is the most popular open source PHP framework. It is very simple and lightweight. It can be used to develop any kind of web project from small website to large scale of application.

2. Why use Hooks in CodeIgniter

Hooks are the special feature of CodeIgniter that allows to change the inner functionality of framework without making any change in core files of framework. The Hooks are defined in application/config/hooks.php.

3. What is routing in CodeIgniter ?

Instead of accessing files directly from browser, Routing enables to serve files differently. Routing is an important part of CodeIgniter that enables to customize default URL pattern according to requirement to use your own and it redirect automatically to matched URL pattern by specified controller and function.

4. How to load Model in CodeIgniter?

Models are PHP classes that are designed to work with information in your database. In CodeIgniter, Model classes are stored in your application/models/ folder. The models will typically be loaded and called from within your controller functions. To load a model you will use the following function:

5. What are the Helpers in CodeIgniter?

The Helpers are the group of functions in a specific category that helps to perform particular functions. There are many helpers in CodeIgniter that you can use according to your requirement. The major CodeIgniter helpers are URL Helpers that assist in creating link, Form Helpers that help you create form elements, Text Helpers to perform various text formatting routines, Cookie Helpers to set and read cookies, File Helpers to help you deal with files etc.

6. How to unset session in CodeIgniter?

We can unset session variable in CodeIgniter like below.

7. How to access config variable in CodeIgniter?

We can access config variable name in CodeIgniter like below.
$this->config->item('variable name');

8. How to use or add libraries CodeIgniter?

To use new libraries in your project, we can add the new library to the autoload library array in config/autoload.php.
$autoload['libraries'] = array ('database', 'session', 'auth');

9. What is inhibitor in CodeIgniter?

The Inhibitor is an error handler class in CodeIgniter. With Inhibitor, we can handle parse errors, exceptions, fatal errors while using native PHP functions like et_exception_handler, set_error_handler, register_shutdown_function tec.

10. Why CodeIgniter called as loosely based mvc framework?

Because CodeIgniter does not need to follow strict MVC patter while creating applications. It's not essential to create model, we can create application with view and controllers only.

You may also check:

You may like these posts