Actually the question in the title. I want to find an analogue of such a code:

<meta http-equiv="refresh" content="10; url=http://google.ru"/> 

for php, so that you can send via header (), or something similar to this to work even if there are no js, ​​the meta tag does not suit me for my own reasons.

  • For what? And those who have javascript disabled are not extinct yet? - Zowie
  • Well, nevertheless there are% such which have no js. There is no way to change the header in the template. - webcrack96

3 answers 3

The answer is on the surface. All meta tags with the http-equiv attribute are equivalent to the same http-headers.

 header("refresh: 10; url=http://google.ru/"); 
     sleep(10); header('Location: http://google.ru'); exit; 

    Note that php - server language and delay can only be put like this.

    • By the way - as for php on the server (assuming that it is highload), with this approach, many users will catch 502. **** Truth is, rather, the problem of php and not the approach .. - Zowie
    • This option does not quite fit. Probably I will torture an intermediate page through which the users will be redirected to the right place. - webcrack96
    • Without the meta tag and js?) Well, hmm, good luck or something) - Sh4dow

    Maybe so ?

     echo '<script>setTimeout(\'location="http://ya.ru"\', 10000)</script>'; 
    • > to work even if there is no js - Sh4dow
    • In this case, you will need a browser. - Andrei Arshinov