作者 李铮

新增退出登录功能

... ... @@ -315,4 +315,17 @@ class User extends Frontend
Db::commit();
$this->success('SUCCESS','',['token'=>$token]);
}
/**
* 注销登录
*/
public function logout()
{
//注销本站
$this->auth->logout();
session('token',null);
Cookie::delete('token');
$this->redirect(url('index/index'));
// $this->success(__('Logout successful'), url('index/index'));
}
}
\ No newline at end of file
... ...
... ... @@ -31,6 +31,11 @@
</a>
{/if}
{/notempty}
{notempty name="$token"}
<a href="{:url('index/user/logout')}" class="btn">
退出
</a>
{/notempty}
</div>
</div>
</header>
\ No newline at end of file
... ...