当前版本
$app = new Web();
$app->register();
$app->autoResponse();
$response = $app->handle($uri);
$app->isAllowDomain(); // 这里会判断是否允许域名访问
$uri = $app->fomat($uri);
$app['url']->deRewrite($uri);
$route = $app[Router]->handle($uri)
new Router()
$router->get('');
reurn new Route();
$route->handle($app['request'], $app['response'])
$module = $router->getMoudle()
$module->boot();
$module->invoke()
return
$package = $module->getControlerNamespace();
$controller = $route->getController($package)
$controller->init();
$controller->invoke($action);
$controller->beforeFilter()
$controller->$action()
$app['view']->render()
$response->send();
$response->sendHeader();
$response->sendContent();
中间件版本
$app = new Web()
$app->middleware(Middleware::class)
$app->middleware(function($req, $resp, $next))
$response = $app->handle($uri)
DomainMiddleware // 是否允许当前域名
CORSMiddleware // 跨域验证
CacheMiddleware // 静态缓存检测
GZIPMiddleware // 压缩输出
RewriteMiddleware // 重写解析还原真实
RouterMiddleware // 路由解析,下一步到控制器
MatchRouteMiddle
[any]Middleware
ModuleMiddleware
DefaultRouteMiddle
Controller
CSRFMiddleware
RuleMiddleware // 控制器中的规则过滤
AuthMiddleware // 登陆验证
HttpMethodMiddleware // 请求方式验证
RoleMiddleware // 角色验证
UriParameterMiddleware // 方法参数过滤
ResponseBodyMiddleware // 加密解密
$response->send();
目前还不确定是否升级
转载请保留原文链接: https://zodream.cn/blog/id/29.html