Home  >  Article  >  Backend Development  >  关于在PHP里的跳转的一个有关问题

关于在PHP里的跳转的一个有关问题

WBOY
WBOYOriginal
2016-06-13 10:34:40589browse

关于在PHP里的跳转的一个问题
举个例子,A链接“www.abc.com/test.php”
判断如果 eregi('abc', $_SERVER['HTTP_REFERER']) || strpos( $_SERVER['HTTP_HOST'], ‘abc’)!==false
就跳转到www.def.com/test.php

本地测试通过,但在服务器上会两个网址反复跳转,后来去掉strpos( $_SERVER['HTTP_HOST'], ‘abc’)!==false 正常。
原因是什么?

另外,我用的跳转方式是
echo '';exit;
其它正常,但苹果浏览器好像也还是不行。。求解。。


有没有更加好的办法,我之前试过不少都没有效果,例如输出 header、javascript ,好像和浏览器也有关系?


------解决方案--------------------
你可以同 

header("location: www.def.com/test.php");


------解决方案--------------------
abc和def只是域名不一样,所指向的目录和文件都是一样的
这个就是关键,操作的其实是同一个文件。
------解决方案--------------------
不知道是不是同一个文件,迷惑~~求解~~

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn