乐于分享
好东西不私藏

MyBatis 源码深度拆解(四):SqlSession 体系深度拆解

MyBatis 源码深度拆解(四):SqlSession 体系深度拆解

面试官:SqlSession 是什么?它和 SqlSessionFactory 是什么关系?SqlSession 里的四大对象是什么时候创建的?


一、回顾与开篇

前几篇我们走通了整体架构,也看了配置加载和 Mapper 代理。今天我们把目光聚焦到SqlSession这个“门面”上。

先看一段最熟悉的代码:

// 1. 构建 SqlSessionFactorySqlSessionFactory factory = new SqlSessionFactoryBuilder().build(inputStream);// 2. 打开 SqlSessionSqlSession session = factory.openSession();// 3. 获取 Mapper 并执行UserMapper mapper = session.getMapper(UserMapper.class);User user = mapper.selectById(1);// 4. 关闭会话session.close();

第 2 步和第 4 步就是今天的主角:SqlSession 的创建与销毁

本篇目标

  • 搞清楚SqlSessionFactory的构建过程
  • 深入DefaultSqlSession的核心实现
  • 理清四大对象(Executor、StatementHandler、ParameterHandler、ResultSetHandler)的初始化时机
  • 理解一级缓存与 SqlSession 的绑定关系

一句话总结

  • SqlSessionFactory是生产SqlSession的工厂
  • SqlSession是MyBatis的门面接口,对外提供统一的数据库操作API。具体执行时,SqlSession将操作委托给Executor执行器,由Executor统一调度StatementHandlerParameterHandlerResultSetHandler三大组件完成SQL执行与结果映射。
  • DefaultSqlSession 是 MyBatis 原生提供的默认实现类,也是最常用的实现。除此之外,MyBatis 还提供了 SqlSessionManager 实现。在 Spring 整合环境中,核心实现则是 SqlSessionTemplate

本文主要分析MyBatis原生框架中SqlSession的核心设计与实现。第3章补充说明在Spring整合环境下的额外机制(Mapper扫描、SqlSessionTemplate等),阅读时请注意区分纯MyBatis原生逻辑与Spring整合层逻辑

二、SqlSessionFactory 构建流程

2.1 从 builder.build() 说起

// SqlSessionFactoryBuilderpublic SqlSessionFactory build(InputStream inputStream, String environment, Properties properties) {    try {        XMLConfigBuilder parser = new XMLConfigBuilder(inputStream, environment, properties);        Configuration config = parser.parse();  // 解析配置        return build(config);                    // 构建 SqlSessionFactory    } catch (Exception e) {        throw ExceptionFactory.wrapException("Error building SqlSession.", e);    }}public SqlSessionFactory build(Configuration config) {    return new DefaultSqlSessionFactory(config);}

非常简单:解析完 Configuration 后,直接 new DefaultSqlSessionFactory(config)

2.2 DefaultSqlSessionFactory 的结构

// DefaultSqlSessionFactorypublic class DefaultSqlSessionFactory implements SqlSessionFactory {    private final Configuration configuration;    public DefaultSqlSessionFactory(Configuration configuration) {        this.configuration = configuration;    }    // 各种 openSession 重载方法,最终都调用 openSessionFromDataSource    @Override    public SqlSession openSession() {        return openSessionFromDataSource(configuration.getDefaultExecutorType(), nullfalse);    }    @Override    public SqlSession openSession(boolean autoCommit) {        return openSessionFromDataSource(configuration.getDefaultExecutorType(), null, autoCommit);    }    @Override    public SqlSession openSession(ExecutorType execType) {        return openSessionFromDataSource(execType, nullfalse);    }    // ... 其他重载}

关键点DefaultSqlSessionFactory 只是 Configuration 的持有者,不保存任何会话状态,所以是线程安全的,可以被多个线程共享。

三、@MapperScan 底层注册流程

3.1 整体设计理念:延迟扫描

在 3.0.x 版本中,@MapperScan的设计理念是延迟扫描 + 职责分离

角色

实现类

核心职责

触发者

@MapperScan 注解

声明扫描范围,通过@Import

导入 Registrar

定义注册者

MapperScannerRegistrar

注册MapperScannerConfigurer

的 BeanDefinition

扫描执行者

MapperScannerConfigurer

实现BeanDefinitionRegistryPostProcessor

,在 Spring 生命周期中触发扫描

核心扫描器

ClassPathMapperScanner

执行真正的包扫描和 BeanDefinition 转换

3.2 阶段一:MapperScannerRegistrar — 注册扫描器定义

@MapperScan 注解通过 @Import 导入了 MapperScannerRegistrar

@Retention(RetentionPolicy.RUNTIME)@Target(ElementType.TYPE)@Import(MapperScannerRegistrar.class)public @interface MapperScan {    String[] basePackages() default {};    // ... 其他属性}

MapperScannerRegistrar 实现了 ImportBeanDefinitionRegistrar 接口,Spring 启动时会调用其 registerBeanDefinitions 方法

@Overridepublic void registerBeanDefinitions(AnnotationMetadata importingClassMetadata,                                     BeanDefinitionRegistry registry) {    // 1. 获取 @MapperScan 注解的所有属性    AnnotationAttributes mapperScanAttrs = AnnotationAttributes.fromMap(        importingClassMetadata.getAnnotationAttributes(MapperScan.class.getName()));    if (mapperScanAttrs != null) {        // 2. 调用重载方法,传入生成的基名        this.registerBeanDefinitions(importingClassMetadata, mapperScanAttrs, registry,                                      generateBaseBeanName(importingClassMetadata, 0));    }}private void registerBeanDefinitions(AnnotationMetadata importingClassMetadata,                                     AnnotationAttributes mapperScanAttrs,                                     BeanDefinitionRegistry registry, String beanName) {    // 3. 创建 MapperScannerConfigurer 的 BeanDefinitionBuilder    BeanDefinitionBuilder builder = BeanDefinitionBuilder        .genericBeanDefinition(MapperScannerConfigurer.class);    // 4. 设置 basePackage(扫描路径)    builder.addPropertyValue("basePackage"        StringUtils.collectionToCommaDelimitedString(basePackages));    // 5. 其他属性设置(sqlSessionFactoryBeanName、annotationClass 等)    // 6. 注册到 Spring 容器,此时扫描尚未执行    registry.registerBeanDefinition(beanName, builder.getBeanDefinition());}

核心要点

  • MapperScannerRegistrar只注册 MapperScannerConfigurer 的 BeanDefinition,不执行扫描
  • 扫描动作被推迟到 Spring 后续的生命周期中执行

3.3 阶段二:MapperScannerConfigurer — 触发扫描

MapperScannerConfigurer 实现了 BeanDefinitionRegistryPostProcessor 接口,这是 Spring 提供的核心扩展点,允许在 Bean 实例化之前修改或新增 BeanDefinition。

Spring 在 refresh() 容器的 invokeBeanDefinitionRegistryPostProcessors 阶段,会回调 postProcessBeanDefinitionRegistry 方法

public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) {    // 1. 处理占位符(如 ${basePackage})    if (this.processPropertyPlaceHolders) {        processPropertyPlaceHolders();    }    // 2. 创建 ClassPathMapperScanner    ClassPathMapperScanner scanner = new ClassPathMapperScanner(registry);    // 3. 设置各项属性    scanner.setAddToConfig(this.addToConfig);    scanner.setAnnotationClass(this.annotationClass);    scanner.setMarkerInterface(this.markerInterface);    scanner.setSqlSessionFactory(this.sqlSessionFactory);    scanner.setSqlSessionTemplate(this.sqlSessionTemplate);    scanner.setResourceLoader(this.applicationContext);    scanner.setBeanNameGenerator(this.nameGenerator);    // 4. 注册过滤器(决定哪些接口被扫描)    scanner.registerFilters();    // 5. 执行扫描(核心动作)    scanner.scan(StringUtils.tokenizeToStringArray(this.basePackage,         ConfigurableApplicationContext.CONFIG_LOCATION_DELIMITERS));}

执行时机:此方法在容器解析完所有 XML 和注解配置之后、任何 Bean 实例化之前执行,是 Spring 提供的最后添加 BeanDefinition 的地方

3.4 阶段三:ClassPathMapperScanner — 扫描与 BeanDefinition 转换

ClassPathMapperScanner 继承自 Spring 的 ClassPathBeanDefinitionScanner,重写了 doScan 方法:

public class ClassPathMapperScanner extends ClassPathBeanDefinitionScanner {    private Class<? extends MapperFactoryBean> mapperFactoryBeanClass = MapperFactoryBean.class;    @Override    public Set<BeanDefinitionHolderdoScan(String... basePackages) {        // 1. 调用父类进行标准组件扫描,得到原始 BeanDefinition(beanClass = 接口本身)        Set<BeanDefinitionHolder> beanDefinitions = super.doScan(basePackages);        if (!beanDefinitions.isEmpty()) {            // 2. 对扫描到的 BeanDefinition 进行二次处理(关键步骤)            processBeanDefinitions(beanDefinitions);        }        return beanDefinitions;    }    private void processBeanDefinitions(Set<BeanDefinitionHolder> beanDefinitions) {        for (BeanDefinitionHolder holder : beanDefinitions) {            BeanDefinition definition = holder.getBeanDefinition();            // 3. 修改 beanClass:将接口类型改为 MapperFactoryBean            definition.setBeanClass(this.mapperFactoryBeanClass);            // 4. 添加构造参数:原始 Mapper 接口类型            definition.getConstructorArgumentValues()                .addGenericArgumentValue(definition.getBeanClassName());            // 5. 添加属性:sqlSessionFactory 或 sqlSessionTemplate            if (this.sqlSessionFactory != null) {                definition.getPropertyValues().add("sqlSessionFactory"this.sqlSessionFactory);            }            if (this.sqlSessionTemplate != null) {                definition.getPropertyValues().add("sqlSessionTemplate"this.sqlSessionTemplate);            }        }    }}

关键转换

转换前

转换后

beanName =userMapper

beanName =userMapper

(不变)

beanClass =com.example.mapper.UserMapper

(接口)

beanClass =MapperFactoryBean

无构造参数

构造参数 =UserMapper.class

3.5 阶段四:MapperFactoryBean — 生成代理对象

经过上述转换,Spring 容器中每个 Mapper 接口都对应一个MapperFactoryBean的 BeanDefinition。

MapperFactoryBean 实现了 FactoryBean 接口,Spring 实例化时会调用 getObject() 方法获取真正的 Mapper 代理对象:

public class MapperFactoryBean<T> extends SqlSessionDaoSupport implements FactoryBean<T> {    private Class<T> mapperInterface;    public MapperFactoryBean(Class<T> mapperInterface) {        this.mapperInterface = mapperInterface;    }    @Override    public T getObject() throws Exception {        // 通过 SqlSession 获取 Mapper 代理对象        return getSqlSession().getMapper(this.mapperInterface);    }}

getSqlSession().getMapper()的调用链最终进入 MyBatis 核心:

SqlSessionTemplate.getMapper()    → Configuration.getMapper()        → MapperRegistry.getMapper()            → MapperProxyFactory.newInstance()                → Proxy.newProxyInstance() → 生成 MapperProxy

最终,Spring 容器中存入的是 MapperProxy 动态代理对象,这就是为什么我们可以直接用 @Autowired 注入一个接口的原因。

3.6 完整调用链总览

启动类 @MapperScan("com.example.mapper")    ↓@Import(MapperScannerRegistrar.class)    ↓MapperScannerRegistrar.registerBeanDefinitions()    → 注册 MapperScannerConfigurer 的 BeanDefinition    ↓Spring refresh() → invokeBeanDefinitionRegistryPostProcessors    ↓MapperScannerConfigurer.postProcessBeanDefinitionRegistry()    → 创建 ClassPathMapperScanner    → 调用 scanner.scan(basePackages)        ↓    ClassPathMapperScanner.doScan()        → super.doScan() → 父类扫描包,发现 Mapper 接口        → processBeanDefinitions()            → 修改 BeanDefinition:beanClass = MapperFactoryBean            → 添加构造参数:原始 Mapper 接口类型        ↓    MapperFactoryBean.getObject()        → sqlSession.getMapper(mapperInterface)            → MapperRegistry.getMapper()                → MapperProxyFactory.newInstance()                    → JDK 动态代理 → MapperProxy        ↓Spring 容器注入 MapperProxy 代理对象

四、DefaultSqlSession 核心源码拆解

4.1 核心字段

public classDefaultSqlSessionimplementsSqlSession{    private final Configuration configuration;  // 全局配置    private final Executor executor;            // 执行器    private final boolean autoCommit;           // 是否自动提交    private boolean dirty;                      // 是否有数据变更(用于判断是否需要提交/回滚)    private List<Cursor<?>> cursors;            // 游标集合,用于 close 时批量关闭    // ... 其他}

4.2 查询方法链路

以 selectOne 为例:

// DefaultSqlSession@Overridepublic <T> T selectOne(String statement, Object parameter) {    // 委托给 selectList,然后取第一个元素    List<T> list = this.selectList(statement, parameter);    if (list.size() == 1) {        return list.get(0);    } else if (list.size() > 1) {        throw new TooManyResultsException("...");    } else {        return null;    }}@Overridepublic <E> List<E> selectList(String statement, Object parameter) {    return this.selectList(statement, parameter, RowBounds.DEFAULT);}@Overridepublic <E> List<E> selectList(String statement, Object parameter, RowBounds rowBounds) {    try {        // 1. 从 Configuration 中获取 MappedStatement        MappedStatement ms = configuration.getMappedStatement(statement);        // 2. 委托给 Executor 执行        return executor.query(ms, wrapCollection(parameter), rowBounds, Executor.NO_RESULT_HANDLER);    } catch (Exception e) {        throw ExceptionFactory.wrapException("Error querying database.  Cause: " + e, e);    } finally {        ErrorContext.instance().reset();    }}

关键点

  • selectOne本质是selectList的包装,取第一个元素
  • statement参数是 Mapper XML 中的namespace.methodId
  • 参数如果是集合类型,会被包装(避免参数名解析问题)

4.3 更新方法链路

以 insert / update / delete 为例,它们都走 update 方法:

// DefaultSqlSession@Overridepublic int insert(String statement, Object parameter) {    return update(statement, parameter);}@Overridepublic int update(String statement, Object parameter) {    try {        dirty = true;  // 标记数据已变更        MappedStatement ms = configuration.getMappedStatement(statement);        return executor.update(ms, wrapCollection(parameter));    } catch (Exception e) {        throw ExceptionFactory.wrapException("Error updating database.  Cause: " + e, e);    } finally {        ErrorContext.instance().reset();    }}

关键点dirty标志用于标记当前SqlSession是否执行过任何数据变更操作(insert/update/delete),是事务提交判断的核心依据:

  • autoCommit = false时,commit()方法会检查isCommitOrRollbackRequired方法,若dirtytrue则提交事务并将dirty重置为falseclose()方法同理,若dirtytrue则回滚事务。
  • autoCommit = true时,dirty标志不影响提交/回滚,因为数据库事务由JDBC自动提交管理。

需要注意的是,以上是纯MyBatis原生机制。在Spring整合场景下,事务由Spring的PlatformTransactionManager统一管理,不应再手动调用sqlSession.commit()

4.4 事务管理:commit / rollback / close

// DefaultSqlSession@Overridepublic void commit() {    commit(false);}@Overridepublic void commit(boolean force) {    try {        // 提交事务,force 参数表示即使不 dirty 也提交        executor.commit(isCommitOrRollbackRequired(force));        dirty = false;  // 提交成功后重置 dirty    } catch (Exception e) {        throw ExceptionFactory.wrapException("Error committing transaction.  Cause: " + e, e);    } finally {        ErrorContext.instance().reset();    }}@Overridepublic void rollback() {    rollback(false);}@Overridepublic void rollback(boolean force) {    try {        // 回滚事务        executor.rollback(isCommitOrRollbackRequired(force));        dirty = false;    } catch (Exception e) {        throw ExceptionFactory.wrapException("Error rolling back transaction.  Cause: " + e, e);    } finally {        ErrorContext.instance().reset();    }}@Overridepublic void close() {    try {        // 如果有未提交的变更,回滚        if (dirty) {            executor.rollback(true);        }        // 关闭 executor(会关闭连接)        executor.close(true);        dirty = false;    } catch (Exception e) {        throw ExceptionFactory.wrapException("Error closing session.  Cause: " + e, e);    } finally {        ErrorContext.instance().reset();    }}// 判断是否需要提交/回滚private boolean isCommitOrRollbackRequired(boolean force) {    return (!autoCommit && dirty) || force;}

事务逻辑总结

场景

autoCommit=false(默认)

autoCommit=true

执行更新后

dirty=true,需要手动 commit

自动提交,dirty 变化不影响

close() 时

如果 dirty=true,自动 rollback

直接关闭

commit(force)

正常提交

即使 autoCommit=true 也提交

五、四大对象的初始化时机

5.1 Executor:SqlSession 创建时初始化

openSessionFromDataSource中,通过configuration.newExecutor()创建。

5.2 StatementHandler:执行 SQL 时创建

// SimpleExecutor.doQuerypublic <E> List<E> doQuery(MappedStatement ms, Object parameter, RowBounds rowBounds,                            ResultHandler resultHandler, BoundSql boundSql) throws SQLException {    Statement stmt = null;    try {        Configuration configuration = ms.getConfiguration();        // 创建 StatementHandler        StatementHandler handler = configuration.newStatementHandler(wrapper, ms, parameter, rowBounds, resultHandler, boundSql);        // ...    }}
// Configurationpublic StatementHandler newStatementHandler(Executor executor, MappedStatement ms, Object parameter,                                              RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) {    // 创建 RoutingStatementHandler(会根据 SQL 类型路由到对应的 StatementHandler)    StatementHandler statementHandler = new RoutingStatementHandler(executor, ms, parameter, rowBounds, resultHandler, boundSql);    // 插件拦截    statementHandler = (StatementHandler) interceptorChain.pluginAll(statementHandler);    return statementHandler;}

5.3 ParameterHandler 和 ResultSetHandler:在 StatementHandler 创建时初始化

// RoutingStatementHandler 构造方法publicRoutingStatementHandler(Executor executor, MappedStatement ms, Object parameter,                                RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) {    // 根据 MappedStatement 的类型,选择具体的 StatementHandler    switch (ms.getStatementType()) {        case STATEMENT:            delegate = new SimpleStatementHandler(executor, ms, parameter, rowBounds, resultHandler, boundSql);            break;        case PREPARED:            delegate = new PreparedStatementHandler(executor, ms, parameter, rowBounds, resultHandler, boundSql);            break;        case CALLABLE:            delegate = new CallableStatementHandler(executor, ms, parameter, rowBounds, resultHandler, boundSql);            break;        default:            throw new RuntimeException("...");    }}

而这些具体的 StatementHandler 的父类 BaseStatementHandler 在构造时会创建 ParameterHandler 和 ResultSetHandler

// BaseStatementHandler 构造方法protected BaseStatementHandler(Executor executor, MappedStatement ms, Object parameter,                                RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) {    // ...    this.parameterHandler = configuration.newParameterHandler(ms, parameter, boundSql);    this.resultSetHandler = configuration.newResultSetHandler(executor, ms, rowBounds, parameterHandler, resultHandler, boundSql);}

总结

对象

初始化时机

创建位置

Executor

openSession 时

Configuration.newExecutor()

StatementHandler

执行 SQL 时

Configuration.newStatementHandler()

ParameterHandler

创建 StatementHandler 时

Configuration.newParameterHandler()

ResultSetHandler

创建 StatementHandler 时

Configuration.newResultSetHandler()

六、一级缓存与 SqlSession 的绑定

一级缓存是 SqlSession 级别的,在 Executor 中实现。回顾 BaseExecutor

// BaseExecutorpublic abstract class BaseExecutor implements Executor {    protected PerpetualCache localCache;      // 一级缓存    protected PerpetualCache localOutputParameterCache;    // 查询时先从缓存取    @Override    public <E> List<E> query(MappedStatement ms, Object parameter, RowBounds rowBounds,                              ResultHandler resultHandler, CacheKey key, BoundSql boundSql) {        // 从 localCache 中获取        List<E> list = resultHandler == null ? (List<E>) localCache.getObject(key) : null;        if (list != null) {            // 缓存命中            handleLocallyCachedOutputParameters(ms, key, parameter, boundSql);        } else {            // 缓存未命中,从数据库查询            list = queryFromDatabase(ms, parameter, rowBounds, resultHandler, key, boundSql);        }        return list;    }}

关键点

  • 一级缓存的生命周期 = SqlSession 的生命周期
  • SqlSession 关闭时,一级缓存随之销毁
  • 执行 update/insert/delete 会清空一级缓存

七、面试高频题

Q1:SqlSessionFactory 是线程安全的吗?SqlSession 呢?

A

  • SqlSessionFactory是线程安全的,因为它只持有Configuration(不可变),多个线程可以共享同一个工厂。
  • SqlSession不是线程安全的,每个线程应该有自己的 SqlSession,用完关闭。这也是为什么在 Web 应用中,通常一个请求对应一个 SqlSession。

Q2:openSession() 和不带参数的 openSession() 有什么区别?

A

  • openSession():不自动提交,需要手动 commit。
  • openSession(true):自动提交,每次 SQL 执行后自动 commit。
  • openSession(ExecutorType.BATCH):批量执行器,适合批量操作。

Q3:Executor 和 StatementHandler 的区别?

A

  • Executor是执行器的顶级接口,负责管理一级缓存、事务、批量操作等粗粒度的逻辑。
  • StatementHandler负责细粒度的 JDBC Statement 操作:创建 Statement、设置参数、执行 SQL、处理结果集。
  • Executor 内部调用 StatementHandler 完成具体的数据库操作。

Q4:DefaultSqlSession 里的 dirty 标志位有什么用?

Adirty表示自上次 commit/rollback 以来,是否执行过 insert/update/delete 等变更操作。在close()时,如果dirty为 true 且autoCommit为 false,则会自动回滚,防止未提交的变更被意外丢失。

Q5:SqlSession 的 close() 会不会把连接也关了?

A:会。close()会调用executor.close(),最终关闭数据库连接(连接会归还给连接池)。这也是为什么每次用完 SqlSession 都要 close 的原因。


八、下篇预告

第 5 篇我们将深入Executor 执行器三级架构,详细拆解:

  • SimpleExecutor、ReuseExecutor、BatchExecutor 的实现差异
  • CachingExecutor 如何用装饰器模式包装二级缓存
  • 执行器的创建与选择逻辑

如果觉得有帮助,欢迎点赞、在看、转发支持!

系列持续更新,关注不走丢 👇

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-06-25 00:49:37 HTTP/1.1 GET : https://www.yeyulingfeng.com/a/780184.html
  2. 运行时间 : 0.105901s [ 吞吐率:9.44req/s ] 内存消耗:4,978.09kb 文件加载:145
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=0dab3e4bc17b2625897dc9ea927e18e8
  1. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/composer/autoload_static.php ( 6.05 KB )
  7. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/ralouphie/getallheaders/src/getallheaders.php ( 1.60 KB )
  10. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  11. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  12. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  13. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  14. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  15. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  16. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  17. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  18. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  19. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/guzzlehttp/guzzle/src/functions_include.php ( 0.16 KB )
  21. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/guzzlehttp/guzzle/src/functions.php ( 5.54 KB )
  22. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  23. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  24. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  25. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/provider.php ( 0.19 KB )
  26. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  27. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  28. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  29. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/common.php ( 0.03 KB )
  30. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  32. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/alipay.php ( 3.59 KB )
  33. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  34. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/app.php ( 0.95 KB )
  35. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/cache.php ( 0.78 KB )
  36. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/console.php ( 0.23 KB )
  37. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/cookie.php ( 0.56 KB )
  38. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/database.php ( 2.48 KB )
  39. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/filesystem.php ( 0.61 KB )
  40. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/lang.php ( 0.91 KB )
  41. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/log.php ( 1.35 KB )
  42. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/middleware.php ( 0.19 KB )
  43. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/route.php ( 1.89 KB )
  44. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/session.php ( 0.57 KB )
  45. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/trace.php ( 0.34 KB )
  46. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/config/view.php ( 0.82 KB )
  47. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/event.php ( 0.25 KB )
  48. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  49. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/service.php ( 0.13 KB )
  50. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/AppService.php ( 0.26 KB )
  51. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  52. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  53. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  54. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  55. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  56. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/services.php ( 0.14 KB )
  57. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  58. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  59. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  60. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  61. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  62. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  63. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  64. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  65. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  66. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  67. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  68. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  69. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  70. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  71. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  72. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  73. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  74. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  75. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  76. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  77. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  78. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  79. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  80. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  81. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  82. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  83. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  84. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  85. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  86. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  87. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/Request.php ( 0.09 KB )
  88. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  89. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/middleware.php ( 0.25 KB )
  90. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  91. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  92. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  93. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  94. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  95. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  96. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  97. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  98. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  99. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  100. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  101. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  102. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  103. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/route/app.php ( 3.94 KB )
  104. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  105. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  106. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/controller/Index.php ( 9.87 KB )
  108. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/BaseController.php ( 2.05 KB )
  109. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  110. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  111. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  112. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  113. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  114. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  115. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  116. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  117. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  118. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  119. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  120. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  121. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  122. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  123. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  124. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  125. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  126. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  127. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  128. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  129. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  130. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  131. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  132. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  133. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  134. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  135. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/app/controller/Es.php ( 3.30 KB )
  136. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  137. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  138. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  139. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  140. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  141. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  142. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  143. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  144. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/runtime/temp/c935550e3e8a3a4c27dd94e439343fdf.php ( 31.50 KB )
  145. /yingpanguazai/ssd/ssd1/www/wwww.yeyulingfeng.com/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000429s ] mysql:host=127.0.0.1;port=3306;dbname=wenku;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000721s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000325s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000259s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000575s ]
  6. SELECT * FROM `set` [ RunTime:0.000195s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000660s ]
  8. SELECT * FROM `article` WHERE `id` = 780184 LIMIT 1 [ RunTime:0.000552s ]
  9. UPDATE `article` SET `lasttime` = 1782319777 WHERE `id` = 780184 [ RunTime:0.000530s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 64 LIMIT 1 [ RunTime:0.000221s ]
  11. SELECT * FROM `article` WHERE `id` < 780184 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000438s ]
  12. SELECT * FROM `article` WHERE `id` > 780184 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000355s ]
  13. SELECT * FROM `article` WHERE `id` < 780184 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.000830s ]
  14. SELECT * FROM `article` WHERE `id` < 780184 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.002693s ]
  15. SELECT * FROM `article` WHERE `id` < 780184 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.003721s ]
0.109843s