AAA*_*AAA 3 php session redirect session-variables isset
我找不到这个解决方案.基本上我们使用虚荣网址系统,因此它的user.domain.com.所有文件都可以像user.domain.com/home.php等一样访问.当你清除cookie重定向工作时,它会提示他们再次登录.但是当我使用注销时,它仍然可以工作,但当他们返回到登录链接时(user.domain.com,在用户的登录页面上有一个登录表单)它将无法正常工作.我得到的错误是
错误信息:
The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address
in a way that will never complete.
This problem can sometimes be caused by disabling or refusing to accept
cookies.
Run Code Online (Sandbox Code Playgroud)
重定向所有成员页面的代码:
if(!isset($_SESSION['user_name'])) { header("Location: http://$_SERVER[HTTP_HOST]");}
Note: The $_SERVER[HTTP_HOST] captures the user.domain.com value for redirect.
Run Code Online (Sandbox Code Playgroud)
注销码:
<?php
session_start();
session_destroy();
header( 'Location: $_SERVER[HTTP_HOST]' ) ;
?>
Run Code Online (Sandbox Code Playgroud)
解决此问题的唯一方法是用户清除其Cookie.
更新:使用logout.php后,我去了其中一个成员页面user.domain.com/home.php而不是重定向到user.domain.com进行登录,它给了我重定向错误.这会是会话的问题还是标题的问题?
我可以增强或添加什么来解决这个问题?我尝试过谷歌搜索,但没有找到任何特别的东西.我真的需要一些帮助来解决这个问题.谢谢.
这是我在Safari中收到的错误消息:
Too many redirects occurred trying to open “http://user.domain.com/home.php”.
This might occur if you open a page that is redirected to open another page which then is redirected to open the original page.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
35591 次 |
| 最近记录: |