PHP Codeigniter Technical Interview Questions | Phptpoint

CodeIgniter Interview Questions

/ins>

General CodeIgniter Interview Questions

1-What is Codeigniter ?

Codeigniter based on the MVC pattern is an open sourced framework which develops websites for PHP.

 

2-What are Hooks in Codeigniter ?

Hooks are a feature in codeigniter which help the user to change the inner working without having to change the core files. They are represented by application/config/hooks.php.file. Hooks are more often to be used in executing a script with a particular path within codeigniter.

 

3-What are Helpers in Codeigniter ?

Helpers is the feature in codeigniter where it assists the user in performing specific function. The helper will vary according to the function it’d be assisting such as url helpers will assist in creating links whereas text helpers assist in performing text formatting routines.

 

4-How Do You Load a Model in Codeigniter ?

To load a file in codeigniter you use

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

 

5- What is Routing in Codeigniter ?

Routing is defined as serving PHP files in an alternative way rather than accessing it from the browser. This allows the user to gain unlimited freedom in customizing the default URL pattern to fit his own requirement.

 

6- What are the Security Parameters in Codeigniter ?

To prevent hacking and other malicious activities codigniter applies a cross site scripting hack filter which will automatically start to filter all post and cookie data while comparing it to existing methods that are used to trigger javascript and once an anomaly is detected it is automatically converted into character entries.

 

7-How to Do You Link Images From a View in Codeigniter?

To link images from a view in a codeigniter first use an absolute path to the resources required and link the image from a view in codeigniter

/css/styles.css

/js/query.php

/img/news/566.gpg

 

8-What is an Inhibitor in Codeigniter ?

Inhibitor is a specialist class in codeigniter which primarily functions as a means to combat or handle errors and is primarily comprised of functions such as set_exception_handler set_error_handler register_shutdown_function which are useful in handling parse errors exceptions and fatal errors.

 

9-What is the Default URL Pattern in Codeigniter ?

The default URL patter in codeigniter is split up into four functions which start with the server name,controller class controller name and finally function parameters

To accesses the URL pattern in codeigniter you have to use a URL helper.

 

10-How Can You Extend the Class in Codeigniter ?

To extend a native input class the user must first build a file which is to be named

application/core/MY_Input.php

And then proceed to declare the class with

Class MY_Input extends CI_Input {

}

 

11-How Do You Prevent Codeigniter From CRSF ?

The most common way to protect codeigniter form CRSF is to use a hidden field in every form of the website. This hidden field will be used as a CRSF token which in a random value which changes each and every HTTP request sent. When inserted into a website form it is saved in the user session if the request is the same it becomes legit.

 

12- How Do You Enable CRSF in Codeigniter ?

To enable CRSF the user must follow these steps

application/config/config.php file and setting it to

$config [ ‘csrf_protection’] = TRUE;