https://www.bilibili.com/video/BV14E411t7T4?p=15
1 目前已实现的注解
1.1 @Bean注解 (类注解)
首先扫描的是类注解,然后才会处理方法注解和属性注解
1.2 @Value注解 (属性注解)
从env配置文件去读取数据
1.3.@RequestMapping(方法注解)
用于收集路由
2 使用起来
2.1 \pro\index.php 加载路由
require_once __DIR__."/app/config/define.php"; \Core\BeanFactory::init(); $dispatcher = \Core\BeanFactory::getBean('RouterCollector')->getDispatcher();
2.2 \pro\core\init\RouterCollector.php 请求路由
public function getDispatcher() { //注册路由 $dispatcher = \FastRoute\simpleDispatcher(function (\FastRoute\RouteCollector $r){ foreach($this->routes as $route){ $r->addRoute($route['method'],$route['uri'],$route['handler']); } }); return $dispatcher; }
https://github.com/guainttt/seckill/releases/tag/v10.0