当前位置:首页>python>Python学习--traceback 模块详解

Python学习--traceback 模块详解

  • 2026-07-02 12:30:23
Python学习--traceback 模块详解

一、什么是 traceback 模块?

traceback 模块是 Python 标准库中用于处理异常堆栈跟踪的工具。它提供了各种函数来提取、格式化和打印异常的堆栈信息,帮助开发者定位和理解错误发生的位置。

二、traceback 模块的基本用法

1. 打印异常信息

import tracebackdef basic_traceback():    """traceback 的基本用法"""    def func_c():        return 1 / 0    def func_b():        return func_c()    def func_a():        return func_b()    try:        func_a()    except Exception:        print("=== 使用 traceback.print_exc() ===")        traceback.print_exc()        print("\n=== 使用 traceback.print_exception() ===")        traceback.print_exception(*sys.exc_info())basic_traceback()

2. 获取异常字符串

import tracebackdef get_exception_string():    """获取异常信息的字符串形式"""    def faulty_function():        return int("abc")    try:        faulty_function()    except Exception:        # 获取完整的异常信息字符串        error_string = traceback.format_exc()        print("=== 异常信息字符串 ===")        print(error_string)        # 也可以分别获取        exc_type, exc_value, exc_tb = sys.exc_info()        # 格式化异常类型和值        tb_lines = traceback.format_exception(exc_type, exc_value, exc_tb)        print("=== 格式化的异常列表 ===")        for line in tb_lines:            print(line, end='')get_exception_string()

三、traceback 模块的核心函数

1. print_* 系列函数

import tracebackdef print_functions():    """print_* 系列函数"""    def level3():        raise ValueError("深层错误")    def level2():        level3()    def level1():        level2()    try:        level1()    except ValueError:        print("=== print_exc() ===")        traceback.print_exc()        print("\n=== print_exc(limit=1) - 只显示一层 ===")        traceback.print_exc(limit=1)        print("\n=== print_exc(chain=False) - 不显示异常链 ===")        traceback.print_exc(chain=False)        print("\n=== print_exception() ===")        traceback.print_exception(*sys.exc_info())print_functions()

2. format_* 系列函数

import tracebackdef format_functions():    """format_* 系列函数"""    def recursive_func(n):        if n <= 0:            raise RecursionError("递归深度超限")        return recursive_func(n - 1)    try:        recursive_func(5)    except RecursionError:        # format_exc() - 返回字符串        error_str = traceback.format_exc()        print("=== format_exc() ===")        print(error_str[:200] + "...")        # format_exception() - 返回字符串列表        exc_type, exc_value, exc_tb = sys.exc_info()        error_lines = traceback.format_exception(exc_type, exc_value, exc_tb)        print(f"\n=== format_exception() 返回 {len(error_lines)} 行 ===")        for i, line in enumerate(error_lines[:3]):            print(f"{i+1}{line[:50]}...")format_functions()

3. extract_* 系列函数

import tracebackdef extract_functions():    """extract_* 系列函数 - 提取堆栈帧信息"""    def inner():        return 1 / 0    def middle():        return inner()    def outer():        return middle()    try:        outer()    except ZeroDivisionError:        exc_type, exc_value, exc_tb = sys.exc_info()        # extract_tb() - 提取回溯信息        tb_list = traceback.extract_tb(exc_tb)        print("=== extract_tb() 结果 ===")        for frame in tb_list:            print(f"文件: {frame.filename}")            print(f"行号: {frame.lineno}")            print(f"函数: {frame.name}")            print(f"代码: {frame.line}")            print("-" * 40)        # extract_stack() - 提取当前堆栈        stack = traceback.extract_stack()        print("\n=== extract_stack() 结果 ===")        for frame in stack[-3:]:  # 只显示最后3层            print(f"{frame.filename}:{frame.lineno} in {frame.name}")extract_functions()

四、高级用法

1. 自定义堆栈信息

import tracebackdef custom_stack_info():    """自定义堆栈信息"""    class CustomException(Exception):        pass    def business_logic():        raise CustomException("业务逻辑错误")    def data_processing():        business_logic()    try:        data_processing()    except CustomException as e:        exc_type, exc_value, exc_tb = sys.exc_info()        # 获取原始堆栈        tb_list = traceback.extract_tb(exc_tb)        print("=== 原始堆栈 ===")        for frame in tb_list:            print(f"  {frame.filename}:{frame.lineno} in {frame.name}")        # 添加自定义信息        custom_info = [            "自定义错误信息:",            f"  用户ID: 12345",            f"  操作时间: 2024-01-01 10:00:00",            f"  错误详情: {e}"        ]        print("\n=== 增强的错误信息 ===")        for line in custom_info:            print(line)        # 格式化原始堆栈        print("\n完整堆栈:")        traceback.print_tb(exc_tb)custom_stack_info()

2. 过滤堆栈帧

import tracebackdef filter_stack_frames():    """过滤堆栈帧"""    def utility_function():        return 1 / 0    def business_function():        utility_function()    def api_handler():        business_function()    try:        api_handler()    except ZeroDivisionError:        exc_type, exc_value, exc_tb = sys.exc_info()        # 获取所有堆栈帧        all_frames = traceback.extract_tb(exc_tb)        print("=== 所有堆栈帧 ===")        for frame in all_frames:            print(f"  {frame.name} at {frame.filename}:{frame.lineno}")        # 过滤掉内部函数        filtered_frames = [            frame for frame in all_frames             if not frame.name.startswith('_'and 'utility' not in frame.name        ]        print("\n=== 过滤后的堆栈帧 ===")        for frame in filtered_frames:            print(f"  {frame.name} at {frame.filename}:{frame.lineno}")        # 只显示业务相关的帧        print("\n=== 业务相关堆栈 ===")        traceback.print_exception(exc_type, exc_value, exc_tb, limit=2)filter_stack_frames()

3. 美化异常输出

import tracebackfrom datetime import datetimedef beautify_exception():    """美化异常输出"""    class ColoredTraceback:        """彩色堆栈输出"""        COLORS = {            'red''\033[91m',            'green''\033[92m',            'yellow''\033[93m',            'blue''\033[94m',            'purple''\033[95m',            'cyan''\033[96m',            'reset''\033[0m'        }        @classmethod        def format(cls, exc_type, exc_value, exc_tb):            """格式化异常信息"""            lines = []            # 添加时间戳            timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")            lines.append(f"{cls.COLORS['cyan']}[{timestamp}]{cls.COLORS['reset']}")            # 添加异常类型            lines.append(f"{cls.COLORS['red']}异常类型: {exc_type.__name__}{cls.COLORS['reset']}")            # 添加异常信息            lines.append(f"{cls.COLORS['yellow']}异常信息: {exc_value}{cls.COLORS['reset']}")            # 添加堆栈信息            lines.append(f"\n{cls.COLORS['green']}堆栈跟踪:{cls.COLORS['reset']}")            tb_list = traceback.extract_tb(exc_tb)            for i, frame in enumerate(tb_list):                lines.append(f"  {i+1}. 文件: {frame.filename}")                lines.append(f"     行号: {frame.lineno}")                lines.append(f"     函数: {frame.name}")                if frame.line:                    lines.append(f"     代码: {frame.line.strip()}")                lines.append("")            return '\n'.join(lines)    def deep_function():        return 1 / 0    def middle_function():        deep_function()    def top_function():        middle_function()    try:        top_function()    except Exception:        exc_type, exc_value, exc_tb = sys.exc_info()        print(ColoredTraceback.format(exc_type, exc_value, exc_tb))# beautify_exception()

五、traceback 模块的最佳实践

1. 异常处理模板

import tracebackimport sysfrom functools import wrapsdef exception_templates():    """异常处理模板"""    # 模板1: 简单日志记录    def log_exception(func):        @wraps(func)        def wrapper(*args, **kwargs):            try:                return func(*args, **kwargs)            except Exception:                print("=" * 60)                print(f"函数 {func.__name__} 发生异常:")                traceback.print_exc()                print("=" * 60)                raise        return wrapper    # 模板2: 带返回值的异常处理    def safe_execute(default_value=None, log_error=True):        def decorator(func):            @wraps(func)            def wrapper(*args, **kwargs):                try:                    return func(*args, **kwargs)                except Exception as e:                    if log_error:                        print(f"函数 {func.__name__} 失败: {e}")                        traceback.print_exc()                    return default_value            return wrapper        return decorator    # 模板3: 重试机制    def retry_on_exception(max_retries=3, delay=1, exceptions=(Exception,)):        def decorator(func):            @wraps(func)            def wrapper(*args, **kwargs):                last_exception = None                for attempt in range(max_retries):                    try:                        return func(*args, **kwargs)                    except exceptions as e:                        last_exception = e                        print(f"尝试 {attempt + 1}/{max_retries} 失败: {e}")                        if attempt < max_retries - 1:                            import time                            time.sleep(delay)                        else:                            print(f"函数 {func.__name__} 最终失败")                            traceback.print_exception(type(e), e, e.__traceback__)                            raise            return wrapper        return decorator    # 使用示例    @log_exception    def risky_operation1():        return 1 / 0    @safe_execute(default_value="error", log_error=True)    def risky_operation2():        return int("abc")    @retry_on_exception(max_retries=3, delay=0.5, exceptions=(ValueError,))    def risky_operation3():        import random        if random.random() < 0.7:            raise ValueError("随机错误")        return "成功"    print("=== 模板1: 日志记录 ===")    try:        risky_operation1()    except ZeroDivisionError:        pass    print("\n=== 模板2: 安全执行 ===")    result = risky_operation2()    print(f"结果: {result}")    print("\n=== 模板3: 重试机制 ===")    result = risky_operation3()    print(f"结果: {result}")exception_templates()

2. 性能考虑

import tracebackimport timedef performance_considerations():    """性能考虑"""    # 获取异常信息是昂贵的操作    def expensive_traceback():        try:            raise ValueError("测试错误")        except ValueError:            # 这些操作比较耗时            tb_str = traceback.format_exc()            tb_list = traceback.extract_tb(sys.exc_info()[2])            return tb_str, tb_list    # 只在需要时获取详细信息    class LazyTraceback:        """延迟获取堆栈信息"""        def __init__(self):            self._exc_type = None            self._exc_value = None            self._exc_tb = None            self._formatted = None        def capture(self):            """捕获异常信息"""            self._exc_type, self._exc_value, self._exc_tb = sys.exc_info()            return self        @property        def formatted(self):            """延迟格式化"""            if self._formatted is None and self._exc_tb:                self._formatted = traceback.format_exception(                    self._exc_type, self._exc_value, self._exc_tb                )            return self._formatted        @property        def message(self):            """快速获取错误消息"""            return str(self._exc_value) if self._exc_value else None    # 性能测试    def test_performance():        iterations = 1000        # 完整格式化        start = time.perf_counter()        for _ in range(iterations):            try:                raise ValueError("错误")            except ValueError:                tb = traceback.format_exc()        full_time = time.perf_counter() - start        # 延迟格式化        start = time.perf_counter()        for _ in range(iterations):            try:                raise ValueError("错误")            except ValueError:                lazy = LazyTraceback().capture()                msg = lazy.message  # 只获取消息        lazy_time = time.perf_counter() - start        print(f"完整格式化: {full_time:.3f}秒")        print(f"延迟格式化: {lazy_time:.3f}秒")        print(f"性能提升: {(full_time/lazy_time - 1)*100:.1f}%")    test_performance()performance_considerations()

六、总结

traceback 模块函数速查表

 函数
用途
返回值
print_exc()
打印异常信息
None
print_exception()
打印完整异常
None
print_tb()
打印堆栈跟踪
None
format_exc()
返回异常字符串
str
format_exception()
返回异常列表
List[str]
format_tb()
返回堆栈列表
List[str]
extract_tb()
提取堆栈帧
List[FrameSummary]
extract_stack()
提取当前堆栈
List[FrameSummary]

使用场景总结

 场景
推荐函数
 快速调试
print_exc()
 日志记录
format_exc()
 错误报告
format_exception()
 堆栈分析
extract_tb()
 自定义输出
extract_tb()
 + 自定义格式化

最佳实践

  1. 使用 format_exc() 获取字符串

    try:    # codeexcept Exception:    error_msg = traceback.format_exc()    log.error(error_msg)
  2. 限制堆栈深度

    traceback.print_exc(limit=3)  # 只显示3
  3. 提取特定信息

    tb_list = traceback.extract_tb(exc_tb)last_frame = tb_list[-1]  # 错误发生的帧
  4. 避免在性能敏感代码中使用

    • traceback 操作相对昂贵

    • 使用延迟加载策略

traceback 模块是 Python 异常处理中不可或缺的工具。正确使用它可以帮助你更好地理解错误、调试代码、记录日志,并构建更健壮的应用程序。

最新文章

随机文章

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