1) What is CodeIgniter?
CodeIgniter is an open source PHP framework. It is used to develop web applications and websites. It is loosely based on MVC pattern and easy to use in compare to other PHP framework.
2) Who developed CodeIgniter?
CodeIgniter was developed by EllisLab company.
3) What is Stable version of CodeIgniter?
CodeIgniter's stable version is: 3.1.5 on 20 March 2016.
4) What are the features of CodeIgniter?
CodeIgniter provides various features like:
- Open source framework
- Light Weight
- CodeIgniter is Extensible
- Full Featured database classes
5) What are hooks in CodeIgniter?
In CodeIgniter, hooks provide a way to change inner working of the framework without hacking the core files. It helps to execute a script with a specific path within the CodeIgnite. It is defined in
application/config/hooks.php file.
6) What are the types of hook in CodeIgniter?
There are various types of hook in CodeIgnite like:
- post_controller_constructor
- pre_controller
- pre_sytem
- post_sytem
- cache_override
- display_override
- post_controller
7) How can we load or add a model in CodeIgniter?
In CodeIgniter, we can load or add a model using following functions:
$this->load->model ('Model_Name');
8) What is inhibitor in CodeIgniter?
In CodeIgniter, Inhibitor is an error handler class, that uses following functions to handle parse errors, exceptions, and fatal errors. like:
- set_exception_handler,
- set_error_handler,
- register_shutdown_function
9) What are the features of CodeIgniter?
CodeIgniter features are:
- It is an open source framework.
- It is extremely light weighted.
- It is based on Model View Controller (MVC) pattern.
- It has full featured database classes and support for several platforms.
- It is extensible. We can extend system by using own libraries.
- It has excellent documentation.
10) What are the security parameters for XSS in CodeIgniter?
In CodeIgniter, it provides a cross-site scripting hack prevention filter. This filter either runs automatically or we can run it as per requirement, for filter all POST and COOKIE data. The XSS used filter methods to trigger JavaScript or other types of code that attempt to hijack cookies or other malicious activity. If it detects any suspicious thing or anything disallowed is encountered, it will convert the data to character entities.
11) What is MVC in CodeIgniter?
In CodeIgniter, MVC is design pattern that provides a separate logical view from the presentation view. MVC contains minimal scripting while web page is created.
12) How can we access config variable in CodeIgniter?
In CodeIgniter, we can access config variable by using the following command:
$this->config->item('variable name');
13) How can we unset session in CodeIgniter?
In CodeIgniter, we can unset session using given command:
$this->session->unsetuserdata('somename');;
14) Can I extend the core database class in CodeIgniter?
No, CodeIgniter doesn't allow to extend core database classes.
15) How can we enable CSRF (Cross Site Request Forgery) in CodeIgniter?
We can enable CSRF (Cross Site Request Forgery) in CodeIgniter by setting configuration in the following file:
application/config/config.php file and setting it to
$config [ 'csrf_protection'] = TRUE;
16) How can we create a library in CodeIgniter?
In CodeIgniter, there are some techniques to create a library,
- Creating an entire new library
- Extending native libraries
- Replacing native libraries
17) How can we connect multiple databases in CodeIgniter?
In CodeIgniter, we can connect multiple databases using following command:
$db1 = $this->load->database('group_one', TRUE);
$db2 = $this->load->database('group_two', TRUE);
18) How can we create link image/css/javascript from a view in CodeIgniter?
We can create link image/css/javascript by using following code:
- /css/styles.css
- /js/query.php
- /img/news/566.gpg
19) What is inhibitor in CodeIgniter?
In CodeIgniter, inhibitor is an error handler class.
Example: set_exception_handler, set_error_handler etc.
20) In which language CodeIgniter is written?
PHP
21) How can you print SQL statement in CodeIgniter model?
The following code is used to print SQL statement:
22) How can we get random records in mysql using codeIgniter?
In CodeIgniter, we can get random records in mysql by using given code:
23) Can we extend the core Database class?
No, we cannot extend the core Database class.
24) What the difference is between require and include?
Both is used to include a file but when include file not found .
25) What is the difference between Component, Helper, Behavior?
Component is a Controller extension, Helpers are View extensions, Behavior is a Model Extension.
26) What are CodeIgniter security methods?
There are various CodeIgniter security methods:
- XSS filtering
- CSRF (Cross-site Request Forgery)
- Class reference
27) How to create a driver in CodeIgniter?
In CodeIgniter, the following steps to create a driver:
- Making file structure
- Making driver list
- Making driver(s)
28) How can we load multiple helper files?
The following code is used to load multiple helper files:
$this->load->helper(
array('helper1', 'helper2', 'helper3')
);
29) What is helper?
Helper is a group of functions. The given following helpers are:
URL Helpers: It is used help to create links.
Text Helpers: It is used to perform various text formatting routines.
Cookies Helpers: It is used to set and read cookies.
30) How can we extend class in CodeIgniter?
We can extend class in CodeIgniter create a file name
application/core/MY_Input.php and declare the class with
Class MY_Input extends CI_Input {}.