Interview Questions.

CodeIgniter Interview Questions and Answers - Sep 23, 2021


CodeIgniter Interview Questions and Answers

Codeigniter is the most popular open-source framework for net utility. It may be used to expand any kind of web mission from a small website to huge scale applications. It is loosely based on the famous version–view–controller (MVC) improvement sample, and it is easy to apply evaluate to different PHP frameworks. The first public model of CodeIgniter become launched with the aid of EllisLab on February 28, 2006.

Question 1: What is Codeigniter?

Codeigniter (CI) is the maximum popular open-source framework for internet utility. It may be used to broaden any form of web challenge from small websites to large scale applications. It is loosely primarily based at the famous version–view–controller (MVC) improvement pattern, and it is straightforward to apply examine to other PHP frameworks.The first public model of CodeIgniter become released by way of EllisLab on February 28, 2006.

Question 2: What are the capabilities of Codeigniter?

  • Codeigniter is unfastened to apply,its an open supply framework.
  • Model View Controller Based System.
  • Extremely Light Weight.
  • Full Featured database training with help for several platforms.
  • CodeIgniter is Extensible.The gadget may be without difficulty prolonged thru the usage of your personal libraries, helpers, or via class extensions or device hooks.
  • Full Featured database classes with assist for numerous platforms,Security and XSS Filtering,Error Logging.

Question 3: Explain Codeigniter File Structure?

Following are the folder structure :


  • cache
  • Config
  • Controllers
  • middle
  • errors
  • helpers
  • hooks
  • language
  • libraries
  • logs
  • models
  • 1/3-party
  • views


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


  • css
  • pictures
  • js

Question 4: Explain what are hooks in CodeIgniter?

Codeigniter`s hooks function offers a way to trade the internal working of the framework with out hacking the core files. In different word, hooks can help you execute a script with a selected path in the Codeigniter. Usually, it is described in software/config/hooks.Php document.

    // hook
  $hook['pre_controller'] = array(
  'class' => 'MyClass',
  'function' => 'Myfunction',
  'filename' => 'Myclass.php',
  'filepath' => 'hooks',
  'params' => array('param1', 'param2', 'param3')

Question 5: How to load version in CodeIgniter?

Within your controller capabilities, models will commonly be loaded; you will use the feature

  // syntax
  $this->load->model (‘Model_Name’);

Question 6: How to attach multiple databases in CodeIgniter?

To CodeIgniter join a couple of database concurrently, use following Syntax:

  $DB1 = $this->load->database('group_one', TRUE);
  $DB2 = $this->load->database('group_two', TRUE);

Question 7: Explain what helpers in CodeIgniter are and how you could load a helper report?

In CodeIgniter, helpers are organization of feature in a specific category that allow you to perform particular features. In CodeIgniter, you may locate many helpers like URL helpers- supporting in growing links, Text helpers- carry out diverse textual content formatting exercises, Cookies- helpers set and read cookies. You can load helper file by means of using command:

  // load helper 
  $this->load->helper ('helper-name'); 

Question 8: How are you able to load more than one helper files?

To load more than one helper documents like:

    // syntax
    array('helpername1', 'helpername2', 'helpername3')  

Question 9: Explain CodeIgniter library. How will you load it?

It is an essential part of CodeIgniter as it will increase the growing velocity of an application. To load library use following Syntax:

  // load syntax

Question 10: Explain routing in Codeigniter?

In CodeIgniter, the manner PHP files served is special rather than having access to it without delay from the browser. This manner is called routing. Routing in CodeIgniter offers you the liberty to customise the default URL pattern to use our own URL sample according to the requirement. So, on every occasion there's a request made and fits our URL pattern it will mechanically direct to the specified controller and function.

Question 11: How to connect models to a database manually?

Connect database manually:

  // Syntax Connect database manually

Question 12: What is inhibitor in CodeIgniter?

Inhibitor is an error handler magnificence that uses local PHP features like set_exception_handler, set_error_handler, register_shutdown_function to address parse mistakes, exceptions, and deadly errors.

Question 13: What are CodeIgniter safety strategies?

In CodeIgniter, The Security Class includes methods that help you create a at ease application, processing enter information for protection.

XSS Filtering

Cross-site request forgery (CSRF)

Question 14: What are the security parameters for XSS in CodeIgniter?

In CodeIgniter, XSS stands for move-web page scripting. There are a few cross-web site scripting hack prevention filters in CodeIgniter.

  // syntax
  $data = $this->security->xss_clean($data); 

Question 15: How are you able to allow CSRF in CodeIgniter?

To allow CRSF in Codeigniter all you need to do is:

  // syntax
  $config ['csrf_protection'] = TRUE;  

Set the choice to “TRUE” inside the utility/config/config.Hypertext Preprocessor