Router.php 595 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace PhpLife\Frame;
  3. class Router
  4. {
  5. protected static $list = array();
  6. /**
  7. * 添加路由
  8. * @param $key
  9. * @param $value
  10. */
  11. public static function add($key, $value)
  12. {
  13. self::$list[$key] = $value;
  14. }
  15. /**
  16. * 移除路由
  17. * @param $key
  18. */
  19. public static function remove($key)
  20. {
  21. if (isset(self::$list[$key])) {
  22. unset(self::$list[$key]);
  23. }
  24. }
  25. /**
  26. * 获取路由列表
  27. * @return array
  28. */
  29. public static function getList()
  30. {
  31. return self::$list;
  32. }
  33. }