what is _remap() function?

Remapping Method Calls :-

Remapping Function Calls. If your controller contains a function named _remap(), it will always get called regardless of what your URI contains. It overrides the normal behavior in which the URI determines which function is called, allowing you to define your own function routing rules.

In CodeIgniter, You can remap function calls with the use of the function in your controller called _remap() method. The remap() function will call every time that the controller is called even if a different function is used.We can say that remap() function will remap URI requests to specific controller functions.CodeIgniter will call the _remap() function before calling any other function. This function is very useful to the developers who want to easily remap the function calls or to remap functions instead of extending a routing class of CodeIgniter.

class My extends CI_Controller
{
public function index()
{
echo "i m index";
}
public function _remap($method)
{
if($method == 'index')
{
echo "hi my remap function called";
//$this->load->view('kk');
}
}
}





Previous Next


Trending Tutorials




Review & Rating

0.0 / 5

0 Review

5
(0)

4
(0)

3
(0)

2
(0)

1
(0)

Write Review Here