Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/237.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/grails/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 自定义链接以重定向到另一个链接_Php_Html - Fatal编程技术网

Php 自定义链接以重定向到另一个链接

Php 自定义链接以重定向到另一个链接,php,html,Php,Html,我这里有个情况。我想要一个链接重定向到另一个链接。我在定制php项目中使用它 www.xyz.net/?ref=admin 重定向到注册页面 www.xyz.net/user/register?ref=admin admin可以被任何其他名称替换。您可以试试这个。对不起,我没有时间检查 if(!empty($_GET['ref'])){ $ref = $_GET['ref']; header("Location: http://example.net/user/register

我这里有个情况。我想要一个链接重定向到另一个链接。我在定制php项目中使用它

 www.xyz.net/?ref=admin 
重定向到注册页面

 www.xyz.net/user/register?ref=admin

admin可以被任何其他名称替换。

您可以试试这个。对不起,我没有时间检查

if(!empty($_GET['ref'])){
  $ref = $_GET['ref'];
  header("Location: http://example.net/user/register?ref=$ref");
  exit;
}

那么你的问题是什么?在你说“我该怎么做?”之前,请记住,像这样的问题太宽泛了,因此将被关闭。因此,如果您已经编写了任何代码,我强烈建议将其添加到您的问题中。先生,我已经清楚地提到了我的问题。我想重定向一个url@像你这样的人需要了解更多关于用户期望的信息。你应该试着自己写代码。之后,如果你有问题,你可以张贴你已经尝试了一个明确的解释什么是不工作,并提供一个解决方案。我建议你读一个好的问题和答案。另外,请务必使用.write this window.location=“www.example.com”;添加到index.htmlfile@AnuragAwasthi这将把所有页面请求重定向到该URL。我无法想象这就是他们想要的。谢谢@sonam。它成功了