# 注销 ## 登录 验证成功后,将teacherId利用session存起来,实现了用户登录。 ## 注销 直接将存在于session中的变量,销毁即可。 ### c层 同样写在Login控制器中: ~~~ // 注销 public function logOut() { if (Teacher::logOut()) { return $this->success('logout success', url('index')); } else { return $this->error('logout error', url('index')); } } ~~~ ### M层 同样写在Teacher类中: ~~~ /** * 注销 * @return bool 成功true,失败false。 * @author panjie */ static public function logOut() { // 销毁session中数据 session('teacherId', null); return true; } ~~~ 的确,相比登录而言,注销的确是太简单了。 小作业:好像我们仅仅是看到了一个注销成功的信息而已,而到底有没有真正的注销成功呢?我们又该怎么确认是否注销成功了呢?