php - 当我使用 PHP 更改页面时,我的 URL 没有更新,我该如何解决这个问题?
问题描述
我有一个登录表单,您可以在其中登录,但它不能正常工作。我怀疑它是由于 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
解决方案
<?php
session_start();
$des = session_destroy();
if($des) {
header("Location: login.php");
}
?>
推荐阅读
- nginx - 使用 Nginx 更改默认 URL PhpMyAdmin 的问题
- python - Pytorch torchvision MNIST 下载
- c# - 导航属性上的 EF Core 可选外键
- game-physics - 具有方向向量的 A 框架物理系统复合对撞机
- rust - 如何设置 Cap'n Proto RPC 消息遍历限制?
- java - 在没有 maven 和 Ide 的情况下创建 Project Java Web
- node.js - Mongo userAdminAnyDatabase 无法在其他数据库中创建用户
- ios - 应用程序在模拟器上的显示与故事板上的不同
- c# - 从 Mapsui/SkiaSharp 打印
- data-visualization - qlik 意义上的框附近不需要的工具提示