Thursday, 27 June 2019

Interview questions of codeigniter framework

Interview questions of codeigniter framework


Q 1: What is helper function in codeigniter?
Ans: Helper file is a collection of functions in a particular category.A helper can be loaded by
$this->load->helper('name');
Q 2: Define hook.
Ans: It is use to modify the inner workings of the framework without hacking the core files. When CodeIgniter runs it follows a specific execution process e.g. pre_system , pre_controller etc..
Q 3: How to load a custom library in codeigniter?
Ans: $CI =& get_instance(); On $CI object you can load library.
e.g. $CI->load->library('classname');
Q 4: How load automatically a library in codeigniter ?
Ans: write the name of class in autoload file in autoload array. e.g. database
Q 5:What is the name of database object/
Ans: $ob->
Q 6: How we can require a custom library in controller using APPATH?
Ans: require APPPATH . '/libraries/filename.php';
Q 7: Generate a random sting which contains alphabet and numbers having length 15. Ans: For this we can use string helper function.
e.g. random_string('alnum', 16);
Q 8: In which file you can define the modify routes?
Ans: application/config/routes.php
$route['product'] = 'controller_name/function_name'; browser url will be www.example.com/product
Q 9: Which library is used for form validation in codigniter? Ans: Please type in comment box.