简体   繁体   English

php标头网址作为$ _GET [“ link”]或$ _POST [“ link”]获得的变量

[英]php header url as a variable obtained by $_GET[“link”] or $_POST[“link”]

I am trying to redirect page that can redirect crossdomain but I want to be able to change the destination domain as many times as i want without opening up and editing the php manually. 我正在尝试重定向可以重定向跨域的页面,但是我希望能够多次更改目标域,而无需手动打开和编辑php

To give an eg Domain-A redirects to domain-B but I want to be able to change the target, domain-B to domain-C and so domain-A now redirects to domain-C. 例如,将域A重定向到域B,但是我希望能够将目标从域B更改为域C,因此域A现在重定向到域C。 Can I do this via a form? 我可以通过表格吗? I think I need to have the header as a variable but can't get it to work. 我想我需要将标头作为变量,但无法使其正常工作。 something like: header("location:".$new_url) . 类似于: header("location:".$new_url)

You can use both a GET or a POST request. 您可以同时使用GETPOST请求。 Here's an example with GET : 这是GET的示例:

URL: 网址:

example.com/?redirect=new-domain.com

Code: 码:

header("Location: " . $_GET['redirect']);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM