How to redirect visitor to another page after certain time in PHP? [closed]

丶灬走出姿态 提交于 2019-12-22 17:55:46

问题


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/">


来源:https://stackoverflow.com/questions/5878108/how-to-redirect-visitor-to-another-page-after-certain-time-in-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!