- Posted on
- educationidol
- No Comments
- Interview Questions and Answers for Experience
- 302 Views
Table of Contents
ToggleWhat is CodeIgniter?
CodeIgniter is an powerful and open source framework used for developing web applications. CodeIgniter contains libraries, logical structure and simple interface to access these libraries, plug-ins, helpers and some other resources which solve the complex functions of PHP more easily maintaining high performance.
What are the most prominent features of CodeIgniter?
Proivde list of most prominent features of CodeIgniter:
- It is an open source framework and free to use.
- It is extremely light weighted.
- It is based on the Model View Controller (MVC) pattern.
- It has full featured database classes and support for several platforms.
- It is extensible. You can easily extend the system by using your libraries, helpers.
Explain the folder structure of CodeIgniter.
First download and unzip CodeIgniter, you get the following file structure/folder structure:
Application
cache
Config
Controllers
core
errors
helpers
hooks
language
libraries
logs
models
third-party
views
system
core
database
fonts
helpers
language
libraries
Explain to CodeIgniter architecture.
From a technical point of view, CodeIgniter is dynamically instantiation (light-weighted), loosely coupled (components rely very less on each other) and has a component singularity (each class and functions are narrowly focused towards their purpose).
Explain MVC in CodeIgniter.
CodeIgniter framework is based on MVC pattern. MVC is a software that gives you a separate logical view from the presentation view. Due to this, a web page contains minimal scripting.
Model – The Controller manages models. It represents your data structure. Model classes contain functions through which you can insert, retrieve or update information in your database.
View – View is the information that is presented in front of users. It can be a web page or parts the page like header and footer.
Controllers – Controller is the intermediary between models and view to process HTTP request and generates a web page. All the requests received by the controller are passed on to models and view to process the information.
What is the latest version of Codeigniter?
The latest version of Codeigniter is 4.0, released on September 3, 2019.
How to find the current version of the Codeigniter framework?
Two ways to find to current version.
The first way is to run the code:
The second way is to obtain the system/core/CodeIgniter.php directory and run the code given below:
define(‘CI_VERSION’, ‘2.1.4’);
How is the default timezone set in Codeigniter?
In Codeigniter is set the default timezone by opening the application using the config.php file and adding this code to it.
date_default_timezone_set(‘your timezone’);
What is CodeIgniter Hooks?
Hooks are events which can be called after and before the execution of a program.
Using Hooks feature without change in codeigniter core file we can change the inner working of the framework.
In Codeigniter How many hooks available?
In Codeigniter give the below hooks list which we are using
pre_system : pre_system is called initially during system execution.
pre_controller : pre_controller is called immediately before any of the controllers being called. Example:
$hook[‘pre_controller’] = array(
‘class’ => ‘ExampleClass’,
‘function’ => ‘Examplefunction’,
‘filename’ => ‘ExampleClass.php’,
‘filepath’ => ‘hooks’,
‘params’ => array(‘a’, ‘b’, ‘c’)
);
post_controller : post_controller is called immediately after the complete execution of the controller.
post_controller_constructor :
display_override : display_override overrides the using _display() method.
cache_override :
What is CSRF token in CodeIgniter?
Full form of CSRF is Cross-Site Request Forgery. CSRF token is a random generate value that gets changed in every HTTP request send by webform.
How to set CSRF token?
Syntax : $config[‘csrf_protection’] = TRUE;
Follow below given step to set CSRF token:
1- Go to application/config/config.php
2- Search csrf_protection
3- $config[‘csrf_protection’] = TRUE
How to extend the class in CodeIgniter?
You have to create a file with the name test.php under application/core/ directory and declare your class with the below code:
Class Test extends CI_Input {
// Write your code here
}
What are CodeIgniter security methods?
In CodeIgniter we can use some method to create a secure application and process input data.The methods are given below:
- XSS filtering
- CSRF (Cross-site Request Forgery)
- Class reference
List the databases supported by Codeigniter?
Currently Codeigniter supports these databases that’s are given below :-
- Oracle
- MySQL
- PostgreSQL
- SQLite
- ODBC
- Firebird etc
How to add or load a model in CodeIgniter?
You can do it with this
$this->load->model(“ModelName”);
How to load a view in CodeIgniter?
You can use this
$this->load->view(‘name’);
to load a view in CodeIgniter.
What is the default controller ?
In CodeIgniter when installing codeIgniter by default “welcome.php” is loaded.
How to change the default controller used in CodeIgniter?
In CodeIgniter if you want to change codeIgniter by default file name than you can go it from
application/config/routes.php
In this file you will search
$route[‘default_controller’]
For example, now the frontend is the default controller
$route[‘default_controller’] = ‘Home’;
How will you call a constructor in CodeIgniter ?
parent::_construct();
How is a model added/loaded in Codeigniter?
In Codeigniter , model is loaded and called form the Codeigniter controller. we are using this method to load model.
$this->load->model(‘model_name’);
How to load or use Codeigniter libraries?
In Codeigniter ,$this->load->library(‘library_name’); method is used to load a library.
How do you remove index.php from the URL in Codeigniter?
To remove the index.php from URL in Codeigniter the following steps are used
Open config.php and replaces
$config[‘uri_protocol’] =”AUTO” to $config[‘uri_protocol’] = “REQUEST_URI”
and
$config[‘index_page’] = “index.php” to $config[‘index_page’] = “”
How does the Codeigniter generate raw queries?
To generate the raw queries the below method is used
$this->db->get_compiled_select().
What is the difference between get_compiled_select() and last_query in Codeigniter?
The difference between get_compiled_select() and last_query() is that get_compiled_select() gives the query string which is generated even if the query is not run against the database.
Related Topic :
What is LibreOffice? LibreOffice Impress Features ?