08.10.2017 Views

codeigniter_tutorial

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CodeIgniter<br />

public function computer_graphics()<br />

{<br />

/*Load the URL helper*/<br />

$this->load->helper('url');<br />

redirect('http://www.<strong>tutorial</strong>spoint.com/computer_graphics/index.htm');<br />

}<br />

public function version2()<br />

{<br />

/*Load the URL helper*/<br />

$this->load->helper('url');<br />

}<br />

?><br />

}<br />

/*Redirect the user to some internal controller’s method*/<br />

redirect('redirect/computer_graphics');<br />

Change the routes.php file in application/config/routes.php to add route for the<br />

above controller and add the following line at the end of the file.<br />

$route['redirect'] = 'Redirect_controller';<br />

$route['redirect/version2'] = 'Redirect_controller/version2';<br />

$route['redirect/computer_graphics'] = 'Redirect_controller/computer_graphics';<br />

Type the following URL in the browser, to execute the example.<br />

http://yoursite.com/index.php/redirect<br />

The above URL will redirect you to the <strong>tutorial</strong>spoint.com website and if you visit the<br />

following URL, then it will redirect you to the computer graphics <strong>tutorial</strong> at<br />

<strong>tutorial</strong>spoint.com.<br />

http://yoursite.com/index.php/redirect/computer_graphics<br />

74

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!