How can I use $_GET url variable to redirect the u

2019-08-28 20:26发布

Thank you for your time. I am completely new to PHP and have very little experience so your patience and understanding is very much appreciated.

I am trying to create an exit page which I can display to my users for 5 seconds and then send them to a third party website.

I want to do this on the fly (for example exit.php?site=google.com)

I have tried the following code but it doesn't seem to work

<meta http-equiv="refresh" content="5; url="<?php
echo 'http://www.' . htmlspecialchars($_GET["site"]) . '/';
?>"> 

Any help is much appreciated :)

1条回答
一夜七次
2楼-- · 2019-08-28 20:50

You will want to use the PHP code

header("Location: http://www.example.com/"); 

most likely. What you can try doing is this:

$url = "refresh:5; url=http://www.".$_GET['site'];
header($url)

EDIT: Sorry I forgot to add the 5 second wait time.

查看更多
登录 后发表回答