CodeIgniter Interview Questions and Answers
CodeIgniter is a PHP open-source web development framework for building dynamic websites. Based on the MVC development pattern, Codeigniter can be modified to use the HMVC pattern. This pattern allows developers to maintain controller, view, and models in a sub-directory format. This framework is known for its higher speed as compared to other PHP frameworks. If you are looking for Codeigniter interview questions, we can help you!
A Quick Overview of CodeIgniter | |
---|---|
What is Codeigniter? | It is a PHP open-source web development framework for building dynamic websites. Based on the MVC development pattern, Codeigniter can be modified to use the HMVC pattern. |
Latest Version | 4.0, released on September 3, 2019 |
Stable Version | 3.1.10, released on January 16, 2019 |
Created By | EllisLab |
Written in | PHP |
License | MIT License |
Most Frequently Asked CodeIgniter Interview Questions
$this->db->join('blog', 'comment.blog_id= blog.id', 'inner');
OR
$this->db->join('blog', 'comment.blog_id= blog.id');
To set config value $this->config->set_item('mainURL','bestinterviewquestion.com');
we can use this.
To get config value $this->config->set_item('mainURL');
we can use this.
You can use $this->input->ip_address();
this to get IP Address.
You can use this $this->router->fetch_class();
to get current controller name.
You can use this $this->router->fetch_method();
to get current method.
You can use $this->db->delete('admin', array('id' => 5));
this query to delete record according to condition
// DELETE FROM admin WHERE id = 5
// TRUNCATE table admin;
You can use this to truncate table
$this->db->from('admin'); // select admin table
$this->db->truncate(); // truncate admin table
OR
You can also use like this
$this->db->truncate('admin'); // truncate admin table
Step 1. Make /application/logs
log folder writable
Step 2. Set $config['log_threshold'] = 1;
in /application/config/config.php
We can use the redirect() function to redirect on any page.
$this->load->helper('url');
// Firstly you have to load url helper.
if (condition != TRUE) {
redirect('login_page');
}
$database1 = $this->load->database('DB1', TRUE);
// Connect with database 1
$database2 = $this->load->database('DB2', TRUE);
// Connect with database 2
History of Codeigniter
The first version was released in Feb 2006 by EllisLab.
Advantages of Codeigniter
If you are preparing for Codeigniter interview questions, do memorize the powers of CodeIgniter.
- Easy to learn, handle and customize
- Flexible and easy to configure
- Amazing Active Record Implementation
- Best-in-class documentation
- Discount, Offers, Coupons and Options and Properties
- Extensive user base