如何使用$ _GET url变量重定向用户? [英] How can I use $_GET url variable to redirect the user?

查看:56
本文介绍了如何使用$ _GET url变量重定向用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

感谢您的宝贵时间.我是PHP的新手,几乎没有经验,因此非常感谢您的耐心和理解.

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.

我正在尝试创建一个退出页面,该页面可以向我的用户显示5秒钟,然后将其发送到第三方网站.

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.

我想即时执行此操作(例如exit.php?site = google.com)

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"]) . '/';
?>"> 

非常感谢您的帮助:)

推荐答案

您将要使用PHP代码

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)

对不起,我忘记添加5秒的等待时间.

Sorry I forgot to add the 5 second wait time.

这篇关于如何使用$ _GET url变量重定向用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆