Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.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
将父URL复制到php变量_Php - Fatal编程技术网

将父URL复制到php变量

将父URL复制到php变量,php,Php,下面的代码复制了我的“index.php”页面的URL 但我需要将此代码添加到iframe中的另一个网站,因此我需要获取另一个网站的URL作为父URL,我猜您所说的是引用URL。用这个 $_SERVER['HTTP_REFERER'] 在iframe页面中如果您正在iframe中设置其他网站,您是否已经拥有了它?另外,iframe是html,php不知道html做了什么或正在做什么。当你看到html时,php已经完成了,不再做更多的事情。我的代码显示这个URL:www.mydomain.com

下面的代码复制了我的“index.php”页面的URL


但我需要将此代码添加到iframe中的另一个网站,因此我需要获取另一个网站的URL作为父URL,我猜您所说的是引用URL。用这个

$_SERVER['HTTP_REFERER']

在iframe页面中

如果您正在iframe中设置其他网站,您是否已经拥有了它?另外,iframe是html,php不知道html做了什么或正在做什么。当你看到html时,php已经完成了,不再做更多的事情。我的代码显示这个URL:www.mydomain.com/index.php,你的代码显示这个URL:www.mydomain.com,但是我想显示父网站URL:www.otherdomain.com,很抱歉响应延迟。如果您从
www.otherdomain.com
中的iframe查看
www.mydomain.com/index.php
,在
www.mydomain.com/index.php
中拥有
$\u服务器['HTTP\u REFERER']
,则应向您提供
www.otherdomain.com
我在Fancybox iframe中使用此代码,因此它没有向我提供www.otherdomain.com,它只是给我我的域名www.mydomain.com
$_SERVER['HTTP_REFERER']