How do I redirect with php?

How to make a redirect in PHP?

How can I make a page redirect using php.

PHP Redirect Function When you want to redirect web page you should make a function in php for redirect page it will be very helpful for all your page i am giving you a very simple php code of php redirect function use it whenever you want to call this function use this code.


<?php
//call this function
      redirect_to("yourfile.php");  
?>

<?php
	function redirect_to($new_location) {
	  header("Location: " . $new_location);
	  exit;
	}
?>
PHP Tricks 2016-06-13View: 1296

Categories: PHP Tricks

Comments

Leave a comment