Logout.php 688 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace Widget;
  3. use Widget\Base\Users;
  4. if (!defined('__TYPECHO_ROOT_DIR__')) {
  5. exit;
  6. }
  7. /**
  8. * 登出组件
  9. *
  10. * @category typecho
  11. * @package Widget
  12. * @copyright Copyright (c) 2008 Typecho team (http://www.typecho.org)
  13. * @license GNU General Public License 2.0
  14. */
  15. class Logout extends Users implements ActionInterface
  16. {
  17. /**
  18. * 初始化函数
  19. *
  20. * @access public
  21. * @return void
  22. */
  23. public function action()
  24. {
  25. // protect
  26. $this->security->protect();
  27. $this->user->logout();
  28. self::pluginHandle()->logout();
  29. @session_destroy();
  30. $this->response->goBack(null, $this->options->index);
  31. }
  32. }