- autoload- We need to include library in autoload before used so it will load automatically when needed.
- database- to include DB
- route- to handle default controllers like 404 welcome etc
Index.php - Any Url Request will be handle by this file like (about us or contact us)
- index.php/[controller]/[method]
- Controllers and functions/methods are defined in this file
- Initially We Need to Define Controller like Welcome.php
- multple functions/method in controller
- class Welcome extends CI_Controller {
- File must be protected following this condition
- defined('BASEPATH') OR exit('No direct script access allowed');
- If we call to (index.php/Welcome.php/)
- It shows error because we didn't define index () function
- public function index()
- {
- $this->load->view('welcome_message');
- }
- But if we call to another function Public function test ()
- (index.php/Welcome.php/test)
- It will works even without index () function
No comments:
Post a Comment