我有一个按钮来处理脚本的注销(session_destroy
)部分。但是由于样式问题,我需要一个链接来解决问题。
if (isset($_POST['logout'])) {
session_destroy();
header("Refresh:0");
}
有谁知道我如何在 php 中处理链接?
你可以使用$_GET['logout']
您的链接看起来像
<a href="?logout=true">Logout</a>
和你的 PHP
if (isset($_GET['logout'])) {
session_destroy();
header("Refresh:0");
}