如何在PhP头文件中添加延迟


How To Add A Delay To PhP Header?

如何在标头('Location: '.$_GET['q']);在我的代码中?

<?php
  if (isset($_GET['q']) && !empty($_GET['q'])) {
     if(filter_var($_GET['q'], FILTER_VALIDATE_URL)){
        header('Location: '.$_GET['q']); 
     }else{
        echo "Invalid URL";
     }
  }

Sleep函数将阻塞之后要执行的代码。

也许你要找的是html meta tag refresh

:

<META http-equiv="refresh" content="5;URL=http://www.example.com/mypage">