How to redirect visitor to another page after cert

2019-05-28 14:32发布

问题:

What are some hidden tricks of PHP in putting timeout on the page and redirect it to another page?

回答1:

You can use sleep on the server-side then redirect to another page with header. Or you can send an HTML page with <meta> tag that specifies redirect location and delay time.

Using sleep and header

<?php
sleep(2);
header('Location: http://www.example.com/');
?>

Using <meta> tag

<meta http-equiv="refresh" content="2;url=http://www.example.com/">