我需要一个 link 到 return 的 true 值并在 PHP 中处理该值

I need a link to return a value of true and process that value in PHP

我有一个按钮负责脚本的注销 (session_destroy) 部分。但是由于样式问题,我需要一个 link 来解决问题。

if (isset($_POST['logout'])) {
    session_destroy();
    header("Refresh:0");
}    

有谁知道我如何处理 php 中的 link?

你可以使用 $_GET['logout']

你的 link 看起来像

<a href="?logout=true">Logout</a>

和你的php

if (isset($_GET['logout'])) {
    session_destroy();
    header("Refresh:0");
}