当前位置:首页>python>Python学习--raise 用法详解

Python学习--raise 用法详解

  • 2026-07-02 15:00:59
Python学习--raise 用法详解

一、什么是 raise?

raise 是 Python 中用于手动抛出异常的关键字。当程序检测到错误条件时,可以使用 raise 主动触发异常,中断正常的程序流程。

raise 的基本用法

1. 抛出内置异常

def basic_raise():    """raise 的基本用法"""    # 1. 抛出异常实例    try:        raise ValueError("这是一个值错误")    except ValueError as e:        print(f"捕获到异常: {e}")    # 2. 抛出异常类(会自动创建实例)    try:        raise ValueError    except ValueError as e:        print(f"捕获到异常类: {e}")    # 3. 抛出异常时不带参数    try:        raise ValueError()    except ValueError as e:        print(f"捕获到空异常: {e}")    # 4. 重新抛出当前异常    try:        try:            raise TypeError("类型错误")        except TypeError:            print("重新抛出异常")            raise  # 重新抛出    except TypeError as e:        print(f"最终捕获: {e}")basic_raise()

2. 抛出带参数的异常

def raise_with_args():    """抛出带参数的异常"""    # 单个参数    try:        raise ValueError("错误信息")    except ValueError as e:        print(f"错误信息: {e}")    # 多个参数(某些异常支持)    try:        raise RuntimeError("错误信息""额外信息"123)    except RuntimeError as e:        print(f"多个参数: {e.args}")        print(f"第一个参数: {e.args[0]}")        print(f"第二个参数: {e.args[1]}")    # 使用关键字参数    try:        raise ValueError(message="自定义消息", code=500)    except ValueError as e:        print(f"消息: {e}")        # 注意:ValueError 不支持直接访问关键字参数raise_with_args()

三、自定义异常

1. 创建自定义异常类

def custom_exception_classes():    """自定义异常类"""    # 基础自定义异常    class MyError(Exception):        """我的自定义异常"""        pass    # 带字段的自定义异常    class ValidationError(Exception):        def __init__(self, field, message, code=None):            self.field = field            self.message = message            self.code = code            super().__init__(f"{field}{message}")    # 带方法的自定义异常    class BusinessError(Exception):        def __init__(self, message, severity="error"):            self.message = message            self.severity = severity            self.timestamp = None        def with_timestamp(self):            from datetime import datetime            self.timestamp = datetime.now()            return self        def __str__(self):            return f"[{self.severity.upper()}{self.message}"    # 使用自定义异常    try:        raise MyError("这是一个自定义异常")    except MyError as e:        print(f"自定义异常: {e}")    try:        raise ValidationError("email""邮箱格式不正确", code=1001)    except ValidationError as e:        print(f"验证错误: {e}")        print(f"字段: {e.field}, 代码: {e.code}")    try:        error = BusinessError("业务逻辑错误""critical").with_timestamp()        raise error    except BusinessError as e:        print(f"业务错误: {e}")        print(f"严重级别: {e.severity}")        print(f"时间戳: {e.timestamp}")custom_exception_classes()

2. 异常层次结构

def exception_hierarchy():    """异常层次结构"""    # 定义异常层次    class AppError(Exception):        """应用基础异常"""        pass    class ConfigError(AppError):        """配置错误"""        pass    class DatabaseError(AppError):        """数据库错误"""        pass    class ConnectionError(DatabaseError):        """连接错误"""        pass    class QueryError(DatabaseError):        """查询错误"""        pass    class ValidationError(AppError):        """验证错误"""        pass    def process_data():        """处理数据的函数"""        # 可以抛出不同级别的异常        import random        error_type = random.choice(['config''connection''query''validation'])        if error_type == 'config':            raise ConfigError("配置文件格式错误")        elif error_type == 'connection':            raise ConnectionError("无法连接到数据库")        elif error_type == 'query':            raise QueryError("SQL 语法错误")        else:            raise ValidationError("数据验证失败")    # 处理异常    try:        process_data()    except ConnectionError as e:        print(f"连接错误(具体): {e}")    except DatabaseError as e:        print(f"数据库错误(一般): {e}")    except AppError as e:        print(f"应用错误: {e}")    except Exception as e:        print(f"其他错误: {e}")exception_hierarchy()

四、raise 的高级用法

1. 异常链 (raise ... from)

def exception_chaining():    """异常链 - raise ... from"""    def parse_config(filename):        """解析配置文件"""        try:            with open(filename, 'r'as f:                return eval(f.read())        except FileNotFoundError as e:            # 抛出新的异常,保留原始异常            raise RuntimeError(f"配置文件 {filename} 不存在"from e        except SyntaxError as e:            # 抛出新的异常,保留原始异常            raise RuntimeError(f"配置文件语法错误"from e    def load_settings():        """加载设置"""        try:            config = parse_config("config.txt")            return config        except RuntimeError as e:            # 访问原始异常            print(f"错误: {e}")            print(f"原始错误: {e.__cause__}")            raise    # 使用异常链    try:        load_settings()    except RuntimeError as e:        print(f"\n最终捕获: {e}")        print(f"原因: {e.__cause__}")    # 抑制原始异常 (from None)    def process_without_chain():        try:            result = 10 / 0        except ZeroDivisionError:            raise ValueError("计算错误"from None    try:        process_without_chain()    except ValueError as e:        print(f"\n抑制原始异常: {e}")        print(f"原始异常: {e.__cause__}")  # Noneexception_chaining()

2. 条件性抛出

def conditional_raise():    """条件性抛出异常"""    def validate_age(age):        """验证年龄"""        if not isinstance(age, int):            raise TypeError(f"年龄必须是整数,得到 {type(age).__name__}")        if age < 0:            raise ValueError(f"年龄不能为负数: {age}")        if age > 150:            raise ValueError(f"年龄超出合理范围: {age}")        return True    # 批量验证    ages = [25, -5"三十"20018]    for age in ages:        try:            validate_age(age)            print(f"✓ {age} 验证通过")        except TypeError as e:            print(f"✗ {age}: 类型错误 - {e}")        except ValueError as e:            print(f"✗ {age}: 值错误 - {e}")conditional_raise()

3. 在循环中使用 raise

def raise_in_loop():    """在循环中使用 raise"""    def process_items(items):        """处理项目列表"""        results = []        for i, item in enumerate(items):            try:                # 模拟处理逻辑                if item is None:                    raise ValueError(f"项目 {i} 为 None")                if not isinstance(item, (intfloat)):                    raise TypeError(f"项目 {i} 不是数字")                if item == 0:                    raise ZeroDivisionError(f"项目 {i} 为 0")                result = 100 / item                results.append(result)            except (ValueError, TypeError, ZeroDivisionError) as e:                print(f"跳过项目 {i}{e}")                continue        return results    # 测试    test_data = [10None"abc"052]    results = process_items(test_data)    print(f"处理结果: {results}")raise_in_loop()

五、raise 的最佳实践

1. 异常设计原则

def design_principles():    """异常设计原则"""    # 1. 异常应该有意义    class UserNotFoundError(Exception):        """用户不存在"""        pass    class UserAlreadyExistsError(Exception):        """用户已存在"""        pass    # 2. 提供有用的错误信息    def find_user(user_id):        if user_id <= 0:            raise ValueError(f"无效的用户ID: {user_id}")        # ...    # 3. 使用合适的异常类型    def divide(a, b):        if b == 0:            raise ZeroDivisionError("除数不能为0")  # 使用内置异常        return a / b    # 4. 不要滥用异常    def bad_use(data, index):        try:            return data[index]        except IndexError:            return None  # 应该使用条件判断    def good_use(data, index):        if 0 <= index < len(data):            return data[index]        return None    # 5. 文档化异常    def calculate_price(quantity, price):        """        计算总价        Args:            quantity: 数量            price: 单价        Returns:            总价        Raises:            ValueError: 当数量或价格为负数时            TypeError: 当参数不是数字时        """        if quantity < 0 or price < 0:            raise ValueError("数量和价格不能为负数")        return quantity * price    print("异常设计原则演示完成")design_principles()

2. 异常处理模板

def exception_templates():    """异常处理模板"""    # 模板1: 简单验证    def validate_input(value):        if not value:            raise ValueError("输入不能为空")        return value    # 模板2: 重试模式    def retry_operation(func, max_retries=3, delay=1):        for attempt in range(max_retries):            try:                return func()            except Exception as e:                if attempt == max_retries - 1:                    raise                print(f"重试 {attempt + 1}/{max_retries}{e}")                time.sleep(delay)    # 模板3: 资源管理    class Resource:        def __enter__(self):            # 获取资源            return self        def __exit__(self, exc_type, exc_val, exc_tb):            # 释放资源            if exc_type:                print(f"发生异常: {exc_type.__name__}")            return False    # 模板4: 异常转换    def convert_exception(func):        from functools import wraps        @wraps(func)        def wrapper(*args, **kwargs):            try:                return func(*args, **kwargs)            except ValueError as e:                raise RuntimeError(f"转换后的错误: {e}"from e        return wrapper    # 模板5: 日志记录    import logging    def log_exception(func):        @wraps(func)        def wrapper(*args, **kwargs):            try:                return func(*args, **kwargs)            except Exception as e:                logging.error(f"函数 {func.__name__} 失败: {e}", exc_info=True)                raise        return wrapper    print("异常处理模板演示完成")exception_templates()

六、总结

raise 用法速查表

 用法
语法
说明
 抛出异常实例
raise ValueError("消息")
最常用
 抛出异常类
raise ValueError
自动创建实例
 重新抛出
raise
在 except 块中使用
 异常链
raise NewError from e
保留原始异常
 抑制链
raise NewError from None
隐藏原始异常

最佳实践总结

  1. 使用有意义的异常类型

    • 使用内置异常或自定义异常

    • 不要抛出 Exception 基类

  2. 提供清晰的错误信息

    • 包含出错的具体原因

    • 包含相关的上下文信息

  3. 不要吞掉异常

    • 除非有充分的理由,否则不要忽略异常

    • 记录或重新抛出异常

  4. 合理使用异常链

    • 使用 from 保留原始异常

    • 使用 from None 隐藏实现细节

  5. 文档化异常

    • 在函数文档中说明可能抛出的异常

    • 说明异常的触发条件

  6. 性能考虑

    • 异常处理比条件判断慢

    • 不要用异常控制正常流程

raise 是 Python 中主动抛出异常的关键工具。通过合理使用 raise,可以创建健壮、可维护的程序,清晰地表达错误条件,并提供有用的错误信息。

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-04 14:21:51 HTTP/2.0 GET : https://f.mffb.com.cn/a/489069.html
  2. 运行时间 : 0.252082s [ 吞吐率:3.97req/s ] 内存消耗:5,045.45kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=680778fef253f44505902a425040b3d9
  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.000500s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000737s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000299s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000292s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000516s ]
  6. SELECT * FROM `set` [ RunTime:0.000198s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000524s ]
  8. SELECT * FROM `article` WHERE `id` = 489069 LIMIT 1 [ RunTime:0.000636s ]
  9. UPDATE `article` SET `lasttime` = 1783146111 WHERE `id` = 489069 [ RunTime:0.000739s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000242s ]
  11. SELECT * FROM `article` WHERE `id` < 489069 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000438s ]
  12. SELECT * FROM `article` WHERE `id` > 489069 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000484s ]
  13. SELECT * FROM `article` WHERE `id` < 489069 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.005738s ]
  14. SELECT * FROM `article` WHERE `id` < 489069 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.029092s ]
  15. SELECT * FROM `article` WHERE `id` < 489069 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.143690s ]
0.254717s