
---
title: 请求从开始到结束的完整路径
---
sequenceDiagram
participant User as "用户"
participant index_php as "index.php"
participant plugin_func_php as "model/plugin.func.php"
participant model_inc_php as "model.inc.php"
participant index_inc_php as "index.inc.php"
participant View as "View 层"
participant Route as "Route 层"
participant Model as "Model 层"
participant Core as "Xiuno PHP 核心"
participant DB@{ "type" : "database" } as "数据库"
Note over User,index_inc_php: 【初始化阶段】
User->>index_php: 发送请求
index_php->>Core: 装载 conf.php 文件
index_php->>Core: 装载 Xiuno PHP 核心文件
Core->>DB: 根据 conf.php 文件里的数据库配置连接数据库
index_php->>plugin_func_php: 装载 plugin.func.php 文件,初始化插件功能(主要是Overwrite和Hook机制)
index_php->>model_inc_php: 装载 model.inc.php 文件,初始化 Model 层的配置
model_inc_php->>Model: 装载所有的 Model PHP 文件
index_php->>index_inc_php: 装载 index.inc.php 文件,开始进入路由层
Note over index_inc_php,Core: 【业务逻辑阶段】
index_inc_php->>Route: 使用 switch case 将请求路由到 Route 层里合适的 PHP 文件里
Route-->>Route: 在 Route 层里继续判断合适的sub route
Route-->>Route: 可能会进行前置判断(如是否登录,是否有权限访问该页面)
Route->>Model: 调用 Model 层的合适函数
Model->>Core: 调用 DB 系列函数
Core->>DB: 执行数据库查询
DB-->>Core: 返回数据
Core-->>Model: 返回数据
Model-->>Model: 可能会进行处理(例如thread_format、user_format等)
Model-->>Route: 装填数据
Route->>View: 使用 _include 函数调用对应的 HTML 文件
View-->>User: 输出 HTML