We can use PHP's header() function
We can re-direct or refresh our web pages by simply doing either of the following in our PHP scripts
or codes:
Method I: using header('location...')
You probably know this ol' favourite...
php:
// refresh / re-direct without delay
// ---------------------------------
header( 'location:http://www.desilva.biz/webdsn/' );
?>
Method II: using header('refresh...')
php:
// refresh / redirect to an internal web page
// ------------------------------------------
header( 'refresh: 5; url=/webdsn/' );
echo '
You will be re-directed in 5 seconds...
';// refresh / redirect to an internal web page
// ------------------------------------------
header( 'refresh: 3; url=/' ); # redirects to our homepage
echo '
You will be re-directed in 3 seconds...
';// refresh / redirect to an external web page
// ------------------------------------------
header( 'refresh: 0; url=http://www.example.net' );
echo '
You won\'t know what hit you!
';?>
No comments:
Post a Comment