CodeIgniter Interview Questions and Answers | PHP Gurukul
1.What is CodeIgniter ?
Answers : CodeIgniter is open source & powerful framework used for developing web applications on PHP. It is based on MVC(Model, View, Controller) pattern.
2. What are the features of CodeIgniter ?
Answer : 1. It is an open source framework and free to use.
2. It is extremely light weighted.
3. It is based on MVC(Model, View, Controller) pattern.
4.It has full featured database classes and support for several platforms.
5.Excellent documentation.
3. How you can add or load a model in CodeIgniter ?
Answer :
1 | $this->load->model('Model_Name'); |
4.How you can connect models to database manually ?
Answer : To connect database manually use following syntax :
1 | $this>load->database(); |
5.Explain views in CodeIgniter ?
Answer : View folder contains all the markup files like header,footer, sidebar etc. They can be reused by embedding them anywhere in the controller file. They can’t called directly, they have to be loaded in the controller file.
Click To read : https://phpgurukul.com/codeigniter-interview-questions-and-answers/
6. How can you load a view in CodeIgniter ?
Answer :
1 | $this->load->view('Page_Name'); |
7. Explain controller in CodeIgniter ?
Answer : A Controller is the intermediate between models and view to process HTTP request and generates a web page. It is the center of every request on your web application.
8. What is the default controller in CodeIgniter ?
Answer : The file specified in default controller will be loaded by default .When no file name is mentioned in the URL. By default, it is welcome.php which is the first page to be seen after installing CodeIgniter.
9. What is the basic CodeIginter URL structure ?
Answer : Instead of using query-string approach, it uses a segment base approach.
It’s structure is as follows :
xyz.com/class/function/Id
Class represent controller class that need to be invoked.
Function is the method that is called.
Id is any additional segment that is passed to controllers.
10.How will you call a constructor in CodeIgniter ?
Answer :
1 | parent::_construct(); |
11. Explain what are hooks in CodeIgniter ?
Answer : CodeIgniter’s hooks feature provide a way to change the inner working of framework without hacking the core files. In other words, hooks allow you to execute a script with a particular path with in the CodeIgniter. Usually, it is defined in application/config/hooks.php file.
The hoks feature can be globally enabled/disabled by setting the following item in the application/config/config.php file :
$config[‘enablehooks’]=TRUE;
12.Explain what helpers in CodeIgniter are and how you can load a helper file ?
Answer : In CodeIgniter, helpers are group of function in a particular category that assist you to perform specific functions. In CodeIgniter, you will find many helpers like URL helpers- helping in creating links, Text helpers- perform various text formatting routines, Cookies- helpers set and read cookies. You can can load helper file using command
$this->load->helper(‘name’);
13. Explain routing in CodeIgniter ?
Answer : In CodeIgniter, the way PHP files served is different rather than accessing it directly from the browser. This process is called routing. Routing in CodeIgniter gives you the freedom to customize the default URL pattern to use our own URL pattern according to the requirement. So, whenever there is a request made and matches our URL pattern it will automatically direct to specified controller and function.
14. Why is there a need to configure the URL routes ?
Answer : Changing the URL routes has some benfits like from SEO point of view, to make URL SEO friendly and get more user visits hide some URL element such as a function name, controller name, etc. from the users for security reasons provide different functionality to particular parts of a system.
Click Here to Full Read : https://phpgurukul.com/codeigniter-interview-questions-and-answers/
PHP Gurukul
Welcome to PHPGurukul. We are a web development team striving our best to provide you with an unusual experience with PHP. Some technologies never fade, and PHP is one of them. From the time it has been introduced, the demand for PHP Projects and PHP developers is growing since 1994. We are here to make your PHP journey more exciting and useful.
Website : https://phpgurukul.com
Comments
Post a Comment