【发布时间】:2019-04-19 01:11:40
【问题描述】:
我有一个登录表单,您可以在其中登录,但它不能正常工作。我怀疑它是由于 JQuery Mobile 造成的。当我注销时,我转到主登录页面,但我的 URL 仍然是 logout.php(一个破坏会话的文件,然后使用 header(location) 将用户重定向到登录)并且我无法再登录,因为我的页面被卡住了.当我刷新这得到解决。但是当我尝试登录时,URL 仍然是 login.php。当我现在刷新时,我被重定向回 login.php。刷新在这里不起作用。我怎样才能解决这个问题?以前一切正常,但现在不行了。
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hondensectie</title>
<link rel="stylesheet" href="themes/themerollertest.min.css" />
<link rel="stylesheet" href="themes/jquery.mobile.icons.min.css" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile.structure-1.4.5.min.css" />
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<link type="text/css" rel="stylesheet" href="css/style.css"/>
</head>
上面可以看到头部
<?php
session_start();
session_destroy();
header("location: login.php");
?>
在上面你看到logout.php
【问题讨论】:
-
启用后错误报告会显示什么?
-
如何启用它?
-
我无法完成,但你猜不出是哪里出了问题吗?
-
大多数情况下,如果您使用 jQuery mobile,您会通过 Ajax 发送注销请求,因此后端而不是前端的标头更改!我认为您使用存储来保存用户?所以我认为你需要删除存储,并从后端发送 json,如果 json 在 javascript window.location = 'wanted-url' 中结果为真,并将新数据保存在存储中
标签: php jquery session url login