Php 正在销毁$\u服务器会话?
好的,我没有使用任何会话变量,而是我的代码如下所示:Php 正在销毁$\u服务器会话?,php,http,http-headers,twitter,http-authentication,Php,Http,Http Headers,Twitter,Http Authentication,好的,我没有使用任何会话变量,而是我的代码如下所示: if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm="Enter your Twitter username and password:"'); header('HTTP/1.0 401 Unauthorized'); echo 'Please enter your Twitter username and pas
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="Enter your Twitter username and password:"');
header('HTTP/1.0 401 Unauthorized');
echo 'Please enter your Twitter username and password to view your followers.';
exit();
}
$username = $_SERVER['PHP_AUTH_USER'];
$password = $_SERVER['PHP_AUTH_PW'];
所以,我的问题是,当用户想要注销他们(在本例中)的twitter登录凭据时,如何销毁此登录会话 无法销毁http身份验证登录服务器端。这是这种登录方式的最大缺点之一。您所能做的就是发送另一个401头。浏览器通常会“忘记”旧值,弹出另一个用户/通行证输入对话框,如果用户按下“中止”按钮,他们将“注销”。 两个缺点:
- “中止登录以注销”对话框可能会让用户有点吃惊
- “通常”的意思是:最好不要依赖它
编辑:已经回答过了,php手册的注释中提到了此方法以及其他可能的方法。然而,正如你所说,他们不保证工作。链接:同样的问题,同样的答案