Adding more functions in codeigniter controller
You can call as much functions as you want in the controller. Below given the code of two functions in the controller.
Here i added a new function called bye(). Now you need to create a page called bye_world.php in the view folder. Given below is a bye_world.php page that I created.
Now go to your browser and search as follows :
Here come the output as bye world.
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
public function index()
{
$this->load->view('welcome_message');
}
public function bye()
{
$this->load->view('bye_world');
}
}
Here i added a new function called bye(). Now you need to create a page called bye_world.php in the view folder. Given below is a bye_world.php page that I created.
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<body>
bye world
</body>
</html>
Now go to your browser and search as follows :
Here come the output as bye world.
⇐Prev
Next⇒
Comments
Post a Comment