Codeigniter interview questions for fresher & expert level (Part 2)

Codeigniter interview questions for fresher & expert level (Part 2)

11) Mention what is the default URL pattern used in Codeigniter framework?
Codeigniter framework URL has four main components in default URL pattern. First we have the server name and next we have the controller class name followed by controller function name and function parameters at the end. Codeigniter can be accessed using the URL helper. For example http://servername/controllerName/controllerFunction/parameter1/parameter2.

12) Explain how you can extend the class in Codeigniter?
To extend the native input class in CodeIgniter, you have to build a file named application/core/MY_Input.php and declare your class with
Class MY_Input extends CI_Input {
//your code here

13) Explain how you can prevent CodeIgniter from CSRF?
There are several ways to protect CodeIgniter from CSRF, one way of doing is to use a hidden field in each form on the website. This hidden field is referred as CSRF token; it is nothing but a random value that alters with each HTTP request sent. As soon as it is inserted in the website forms, it gets saved in the user’s session as well. So, when the form is submitted by the users, the website checks whether it is the same as the one saved in the session. If it is same then, the request is legitimate.

14) Explain how you can enable CSRF (Cross Site Request Forgery) in CodeIgniter?
You can activate CSRF (Cross Site Request Forgery) protection in CodeIgniter by operating your application/config/config.php file and setting it to $config [‘csrf_protection’] = TRUE; If you avail the form helper, the form_open() function will insert a hidden csrf field in your forms automatically

15) What are the features of CodeIgniter?
Below is the list of features of CodeIgniter:

  • It is free to use as for open source framework.
  • It is light weight. The core system requires only a few very small libraries. Not like other frameworks that require heavy file libraries.
  • CodeIgniter is Fast. It is faster than any other framework in php.
  • The URLs generated by CodeIgniter are clean and search engine friendly. You will change any url to what ever you want from files.
  • CodeIgniter is Extensible. The system can be easily extended through the use of your own libraries, helpers, or through class extensions or system hooks.
  • CodeIgniter Uses MVC (Model View Controller) which allows great separation between logic and presentation.
  • CodeIgniter requires nearly zero configuration, does not require you to use the command line, not forced to learn a templating language.
  • Full Featured database classes with support for several platforms, Security and XSS Filtering, Error Logging.

16) Explain the folder structure of CodeIgniter?
If you download and unzip CodeIgniter, you will get the following file structure/folder structure:

  • cache
  • Config
  • Controllers
  • core
  • errors
  • helpers
  • hooks
  • language
  • libraries
  • logs
  • models
  • thirdparty
  • views


  • core
  • database
  • fonts
  • helpers
  • language
  • libraries

17) How can you print SQL statement in CodeIgniter model?

18) What is Stable version of CodeIgniter?
CodeIgniter 3.1.2 is the current version of the framework.

19) In Which language CodeIgniter is written?

20) How to access config variable in codeigniter?
$this->config->item('variable name');

Leave a Reply

Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.