require_once('../class.user.php');
$user_logout = new USER();
if($user_logout->is_loggedin()!="")
{
$user_logout->redirect('login.html');
}
if(isset($_GET['logout']) && $_GET['logout']=="true")
{
$user_logout->doLogout();
$user_logout->redirect('login.html');
}
?>
这是我的注销脚本logout.php,它不起作用,请有人帮助我。它重定向到一个没有php错误的空白logout.php页面。我有一个包含所有函数的类用户文件和一个login.html以及back.nd的login.php
答案 0 :(得分:0)
如果没有弄错的话,
error[E0631]: type mismatch in closure arguments
--> src/main.rs:3:14
|
2 | let test_closure = |p| p;
| ----- found signature of `fn(_) -> _`
3 | let ct = ClosureTest { cls: test_closure };
| ^^^^^^^^^^^ expected signature of `for<'r> fn(&'r str) -> _`
|
= note: required by `ClosureTest`
error[E0271]: type mismatch resolving `for<'r> <[closure@src/main.rs:2:24: 2:29] as std::ops::FnOnce<(&'r str,)>>::Output == &'r str`
--> src/main.rs:3:14
|
3 | let ct = ClosureTest { cls: test_closure };
| ^^^^^^^^^^^ expected bound lifetime parameter, found concrete lifetime
|
= note: required by `ClosureTest`
- 错了。
应该是
if($user_logout->is_loggedin()!="") { $user_logout->redirect('login.html'); }
代替。
答案 1 :(得分:0)
if语句的目的:
if($user_logout->is_loggedin()!="")
如果用户没有登录,应该注销用户。如果if语句是:
更有意义if(!$user_logout->is_loggedin())
如果您希望已登录的用户注销,则需要从浏览器访问logout.php,如logout.php?logout = true。这将导致第二个if语句中的代码运行