University of Technology, Sydney (UTS) is a dynamic and career oriented university situated in the
Sep 26, 2016
It does not matter how brilliant student you are, it is the interview that decides the fate. So, it is needless to say that prior preparation for every interview is crucial and if you are one of the web developers, we have something for you. Here, we will be sharing top CodeIgniter interview questions and answers, which is an important allocation for the web world. Keep reading.
Q1. What is CodeIgniter and what are the features of CodeIgniter? Explain.
A– CodeIgniter, an open source framework for a web application, is used to develop websites on PHP and it is loosely patterned on MVC. Amongst many features, CodeIgniter specifically includes three essential features namely lightweight, extensible and it has full featured database classes.
Q2. What are hooks in CodeIgniter and explain different types of hook point in it?
A– The hooks in CodeIgniter help to execute a script to change the inner framework of this web application without changing or hacking the core files. Generally, it is defined in application/config/hooks, PHP files.
The different types of hooks in CodeIgnhiter are as follows–
$hook[‘pre_controller’] = array(
‘class’ => ‘MyClass’,
‘function’ => ‘Myfunction’,
‘filename’ => ‘Myclass.php’,
‘filepath’ => ‘hooks’,
‘params’ => array(‘param1’, ‘param2’, ‘param3’));
Q3. How can someone add a model in CodeIgniter?
A– To add or load model in CodeIgniter, you have to use the function within your controller function– $this->load->model (‘Model_Name’);
Q4. Explain the concept of routing in CodeIgniter.
A– Unlike another framework, the PHP files in CodeIgniter served in a completely different way rather accessing it directly browser. This is called routing. And the unique feature of CodeIgniter router is that it lets you customise the default URL pattern to use your own URL pattern according to your requirement.
Q5. State the security parameter for XSS in CodeIgniter.
Q7. What is inhibitor in CodeIgniter?
A– Inhibitor in CodeIgniter is an error handler class that functions with PHP to handle different errors, exceptions and fatal errors.
Q8. What is a helper in CodeIgniter and how can someone load a helper file?
A– Helpers in CodeIgniter are a group of functions that assists you to perform certain different functions. There are many helpers available in CodeIgniter such as URL helpers, Text helpers, Cookies helpers, etc. You can load a helper using the command as mentioned below– $this->load->helper (‘name’);
Q9. Why do you need to configure the URL routes in CodeIgniter?
A– The reasons can be divided into three parts namely–
To make it more SEO friendly.
To hide many URL elements such as controller name, function name, etc.
To provide different functionality.
Q10. State how can you prevent CodeIgniter from CSRF?
A– There are several ways to protect CodeIgniter from CSRF, and one of such ways is to use a hidden field in each form on the website named as CSRF token.