这里是用户登录的地方。当我登录时,我似乎无法注销,请记住我'不活跃......
C:\Users\xxx\Google Drive\sites\trip\jsbuild>webpack -d --display-error-details
C:\Users\xxx\AppData\Roaming\npm\node_modules\webpack\lib\Chunk.js:49
throw new Error("Chunk.entry was removed. Use hasRuntime()");
^
Error: Chunk.entry was removed. Use hasRuntime()
at Chunk.entry (C:\Users\xxx\AppData\Roaming\npm\node_modules\webpack\lib\Chunk.js:49:9)
at C:\Users\xxx\AppData\Roaming\npm\node_modules\extract-text-webpack-plugin\index.js:201:13
at Array.filter (native)
at Compilation.<anonymous> (C:\Users\xxx\AppData\Roaming\npm\node_modules\extract-text-webpack-plugin\index.js:200:37)
at Compilation.applyPlugins0 (C:\Users\xxx\AppData\Roaming\npm\node_modules\webpack\node_modules\tapable\lib\Tapable.js:68:14)
at Compilation.seal (C:\Users\xxx\AppData\Roaming\npm\node_modules\webpack\lib\Compilation.js:567:8)
at C:\Users\xxx\AppData\Roaming\npm\node_modules\webpack\lib\Compiler.js:514:17
at C:\Users\xxx\AppData\Roaming\npm\node_modules\webpack\node_modules\tapable\lib\Tapable.js:289:11
at C:\Users\xxx\AppData\Roaming\npm\node_modules\webpack\lib\Compilation.js:481:11
at C:\Users\xxx\AppData\Roaming\npm\node_modules\webpack\lib\Compilation.js:452:13
at nextTickCallbackWith0Args (node.js:420:9)
at process._tickCallback (node.js:349:13)
我的php注销码
while($user = $stmt->fetch(PDO::FETCH_ASSOC)) {
$passwordDB = $user['mypassword'];
$email = $user['email_address'];
$userid = $user['user_id'];
}
if ($remember_me == "true"){ // Create a Cookie if remember_me is active
$expire = time()+60*60*24; // Valid for only 1 day
setcookie("cookie_username", $username, $expire, "/");
setcookie("cookie_email", $email, $expire, "/");
setcookie("cookie_userid", $userid, $expire, "/");
} else if ($remember_me == "false") { // Only create a session if remember_me is not active
session_start(); // cannot logout if i put it here
$_SESSION['session_userid'] = $userid;
$_SESSION['session_username'] = $username;
$_SESSION['session_email'] = $email;
}
当我记得我的时候,我可以正常退出&#39;检查已开启。
问题解决:我意外删除了注销顶部的<?php
require_once 'mydatabase.php';
$_SESSION = array();
if (ini_get("session.use_cookies")) {
$params = session_get_cookie_params();
setcookie(session_name(), '', time() - 86400,
$params["path"], $params["domain"],
$params["secure"], $params["httponly"]
);
}
?>
,忘记将其重新插入。
答案 0 :(得分:0)
要杀死所有会话变量,您可以尝试类似于此
的内容if( isset( $_SESSION ) ){
$vars=array(
'session_userid',
'session_username',
'session_email'
);
foreach( $vars as $var ){
@unset( $_SESSION[ $var ] );
}
@session_unset();
@session_destroy();
@session_start();
@session_regenerate_id( true );
}
答案 1 :(得分:0)
在不知道如何检查用户是否已登录的情况下,ID会假设您需要在注销码中session_start();
使用developer tools查看浏览器当前持有的数据。
答案 2 :(得分:0)
我会像这样使用session_start和session_destroy():
<?php
session_start();
session_destroy();
require_once 'mydatabase.php';
if (ini_get("session.use_cookies")) {
$params = session_get_cookie_params();
setcookie(session_name(), '', time() - 86400,
$params["path"], $params["domain"],
$params["secure"], $params["httponly"]
);
}