当前位置:首页>python>python的CEL库介绍

python的CEL库介绍

  • 2026-04-17 08:48:30
python的CEL库介绍

什么是 CEL?

通用表达式语言(Common Expression Language,简称 CEL)是谷歌设计的一种非图灵完备的嵌入式策略和表达式语言。它的核心设计理念是“简洁、高速、安全、可移植”,特别适合嵌入到需要策略评估、数据验证和动态配置的系统中。

CEL 最吸引人的地方在于它的两大核心特性:无副作用和保证终止。这意味着 CEL 表达式执行时不会改变外部状态,只计算结果,而且永远不会陷入死循环,执行时间完全可控。这种设计让它成为 Kubernetes、Envoy 等高性能应用程序中的安全评估引擎。

cel-expr-python 是谷歌官方发布的 Python 实现,它不是从头开发的纯 Python 库,而是封装了官方的 C++ 核心。这样做有两个显著优势:一是保证了与 CEL 原生语义的高度一致,二是未来 C++ 核心的任何功能更新和性能优化都会自动同步到 Python 版本。

安装与基础使用

安装 cel-expr-python 非常简单,使用 pip 即可:

pip install cel-expr-python

安装完成后,让我们从一个最基础的例子开始。这个例子展示了 CEL 最核心的工作流程:创建环境、编译表达式、执行评估:

from cel_expr_python import cel# 第一步:创建环境并声明变量类型# 这一步告诉 CEL 我们会传入哪些变量及其类型cel_env = cel.NewEnv(variables={    "who": cel.Type.STRING,    "age": cel.Type.INT})# 第二步:编译表达式# 编译后的表达式对象可以被重复使用,这是 CEL 性能优势的关键expr = cel_env.compile("'Hello, ' + who + '! You are ' + string(age) + ' years old.'")# 第三步:传入实际数据执行评估result = expr.eval(data={    "who""World",    "age"25})print(result)  # 输出: Hello, World! You are 25 years old.

注意编译步骤返回的表达式对象可以重复使用,只需在每次评估时传入不同的数据即可。这种“一次编译,多次评估”的模式特别适合需要高频评估的场景。

CEL 的类型系统

CEL 拥有丰富的类型系统,支持大多数常见的数据类型。在创建环境时,你需要声明变量类型,这样编译器才能进行类型检查:

from cel_expr_python import cel# 声明各种类型的变量cel_env = cel.NewEnv(variables={    "name": cel.Type.STRING,    "count": cel.Type.INT,    "price": cel.Type.DOUBLE,    "is_active": cel.Type.BOOL,    "tags": cel.Type.list(cel.Type.STRING),      # 字符串列表    "metadata": cel.Type.map(cel.Type.STRING, cel.Type.DYN)  # 动态类型的映射})

cel.Type.DYN 表示动态类型,当你无法确定值的具体类型时可以使用它。cel.Type.list() 和 cel.Type.map() 用于声明容器类型。

实战场景一:接口响应数据的复杂校验

在接口自动化测试中,我们经常需要验证复杂的 JSON 响应。传统方式需要编写大量嵌套的 if 语句,不仅代码冗长,而且难以维护。使用 CEL,我们可以将复杂的校验逻辑压缩为清晰简洁的表达式:

from cel_expr_python import cel# 定义校验环境validation_env = cel.NewEnv(variables={    "response": cel.Type.map(cel.Type.STRING, cel.Type.DYN)})# 编译校验表达式validation_expr = validation_env.compile("""    has(response.data) &&    has(response.data.users) &&    size(response.data.users) > 0 &&    response.data.users.all(u,        has(u.id) &&        has(u.status) &&        u.status == 'active' &&        (!has(u.profile) || !has(u.profile.age) ||         (u.profile.age >= 18 && u.profile.age <= 100))    )""")# 模拟接口响应response_data = {    "data": {        "users": [            {"id"1"status""active""profile": {"age"25}},            {"id"2"status""active""profile": {"age"30}},        ]    }}# 执行校验is_valid = validation_expr.eval(data={"response": response_data})print(f"Response is valid: {is_valid}")  # 输出: Response is valid: True

这段代码中的 all() 函数是 CEL 提供的聚合函数,用于检查列表中的所有元素是否都满足条件。类似的函数还有 exists()、map() 和 filter()。

实战场景二:权限策略的动态测试

在测试权限系统时,我们经常需要验证用户是否满足各种复杂的访问条件。CEL 的表达式语法非常适合描述这类业务规则:

from cel_expr_python import cel# 定义权限检查环境permission_env = cel.NewEnv(variables={    "user": cel.Type.map(cel.Type.STRING, cel.Type.DYN),    "coupon": cel.Type.map(cel.Type.STRING, cel.Type.DYN),    "order": cel.Type.map(cel.Type.STRING, cel.Type.DYN)})# 编译优惠券使用规则can_use_coupon_expr = permission_env.compile("""    coupon.status == 'active' &&    coupon.valid_from <= now &&    coupon.valid_to >= now &&    coupon.min_order_amount <= order.amount &&    (size(coupon.allowed_user_ids) == 0 || user.id in coupon.allowed_user_ids) &&    (size(coupon.excluded_user_ids) == 0 || user.id not in coupon.excluded_user_ids) &&    user.vip_level >= coupon.required_vip_level""")# 测试用例test_cases = [    {        "name""普通用户使用有效优惠券",        "user": {"id"1"vip_level"1},        "coupon": {            "status""active",            "valid_from""2024-01-01",            "valid_to""2024-12-31",            "min_order_amount"100,            "allowed_user_ids": [],            "excluded_user_ids": [],            "required_vip_level"1        },        "order": {"amount"150},        "expected"True    },    {        "name""VIP不足的用户",        "user": {"id"2"vip_level"0},        "coupon": {            "status""active",            "valid_from""2024-01-01",            "valid_to""2024-12-31",            "min_order_amount"100,            "allowed_user_ids": [],            "excluded_user_ids": [],            "required_vip_level"1        },        "order": {"amount"150},        "expected"False    }]# 执行测试for test_case in test_cases:    result = can_use_coupon_expr.eval(data=test_case)    status = "PASS" if result == test_case["expected"else "FAIL"    print(f"{status}{test_case['name']} -> {result}")

注意表达式中的 now 是 CEL 内置的当前时间变量,in 是成员检查操作符。这些内置特性让权限规则的编写变得非常自然。

实战场景三:跨语言项目的统一测试策略

在微服务架构中,不同服务可能使用不同编程语言。CEL 的一大优势是:你可以用 Go 或 Java 的工具链编译表达式,然后在 Python 中执行评估。这确保了不同服务使用完全一致的业务规则:

from cel_expr_python import cel# 假设这是从 Go 服务生成的序列化表达式(protobuf 格式)# 在实际场景中,你会从文件中读取这些二进制数据compiled_expr_proto = b"..."  # 序列化的编译表达式# 反序列化并创建表达式对象expr = cel.deserialize_expr(compiled_expr_proto)# 在 Python 测试中复用完全相同的业务规则test_data = {    "user_level"3,    "order_amount"200,    "coupon_type""discount"}result = expr.eval(data=test_data)print(f"Rule evaluation result: {result}")

这种方式特别适合测试场景:你可以让后端开发人员用 Go 定义规则,测试人员用 Python 编写测试用例,而规则本身是完全一致的。

实战场景四:动态配置的自动化验证

在配置驱动的系统中,验证动态配置的有效性是一个常见需求。CEL 可以让验证逻辑与配置分离,变得易于维护:

from cel_expr_python import celimport yaml# 模拟功能开关配置feature_configs = {    "new_checkout_flow": {        "enabled"True,        "percentage"50,        "allowed_envs": ["staging""production"],        "excluded_users": [10011002],        "start_time""2024-01-01T00:00:00Z",        "end_time""2024-12-31T23:59:59Z"    },    "experimental_ai": {        "enabled"True,        "percentage"10,        "allowed_envs": ["staging"],        "excluded_users": [],        "start_time""2024-06-01T00:00:00Z"    }}# 定义配置验证规则config_env = cel.NewEnv(variables={    "config": cel.Type.map(cel.Type.STRING, cel.Type.DYN),    "user": cel.Type.map(cel.Type.STRING, cel.Type.DYN)})validation_expr = config_env.compile("""    config.enabled == true &&    config.percentage >= 0 && config.percentage <= 100 &&    (size(config.allowed_envs) == 0 || user.env in config.allowed_envs) &&    (size(config.excluded_users) == 0 || user.id not in config.excluded_users) &&    (!has(config.start_time) || now >= timestamp(config.start_time)) &&    (!has(config.end_time) || now <= timestamp(config.end_time))""")def validate_feature_config(feature_name, config, user):    try:        return validation_expr.eval(data={            "config": config,            "user": user        })    except Exception as e:        print(f"Validation error for {feature_name}{e}")        return False# 测试不同用户场景test_users = [    {"id"1"env""staging"},    {"id"1001"env""staging"},  # 被排除的用户    {"id"2"env""production"},    {"id"3"env""development"}   # 不允许的环境]for feature_name, config in feature_configs.items():    print(f"\nValidating {feature_name}:")    for user in test_users:        is_valid = validate_feature_config(feature_name, config, user)        print(f"  User {user['id']} in {user['env']}{is_valid}")

这个例子展示了 CEL 如何处理时间戳、条件检查和集合操作,这些都是配置验证中常见的需求。

实战场景五:智能测试数据生成

在数据驱动测试中,生成符合特定规则的测试数据是一个挑战。CEL 可以帮助你定义数据约束,并验证生成的数据是否满足要求:

from cel_expr_python import celimport randomimport string# 定义数据生成规则generation_env = cel.NewEnv(variables={    "constraints": cel.Type.map(cel.Type.STRING, cel.Type.DYN)})# 编译数据验证规则data_validator = generation_env.compile("""    data.id > 0 &&    data.name.size() >= constraints.min_name_length &&    data.name.size() <= constraints.max_name_length &&    data.age >= constraints.min_age &&    data.age <= constraints.max_age &&    data.score >= 0 && data.score <= 100 &&    data.email.contains('@')""")def generate_random_name(min_len, max_len):    length = random.randint(min_len, max_len)    return ''.join(random.choices(string.ascii_letters, k=length))def generate_random_email(name):    domains = ["example.com""test.com""demo.com"]    return f"{name.lower()}@{random.choice(domains)}"def generate_valid_test_data(constraints):    max_attempts = 100    for _ in range(max_attempts):        # 生成随机数据        name = generate_random_name(constraints["min_name_length"], constraints["max_name_length"])        test_data = {            "id": random.randint(110000),            "name": name,            "age": random.randint(constraints["min_age"], constraints["max_age"]),            "score": random.uniform(0100),            "email": generate_random_email(name)        }        # 验证数据        if data_validator.eval(data={"data": test_data, "constraints": constraints}):            return test_data    raise Exception("Failed to generate valid test data")# 定义约束条件constraints = {    "min_name_length"3,    "max_name_length"10,    "min_age"18,    "max_age"65}# 生成多个有效的测试数据for i in range(5):    test_data = generate_valid_test_data(constraints)    print(f"Generated test data {i+1}{test_data}")

CEL 表达式语法要点

CEL 的语法类似于 C 语言,但更简洁。以下是一些常用的语法元素:

条件判断:

# 使用三元运算符status = user.age >= 18 ? "adult" : "minor"

集合操作:

# 检查列表中是否有符合条件的元素has_vip = users.exists(u, u.vip_level >= 3)# 过滤列表active_users = users.filter(u, u.status == "active")# 映射列表user_names = users.map(u, u.name)

字符串操作:

full_name = first_name + " " + last_nameis_valid_email = email.contains("@") and email.endsWith(".com")

时间操作:

is_expired = expiration_time < nowis_within_range = start_time <= timestamp(request.time) <= end_time

性能特点

CEL 的评估速度非常快,官方宣称可以达到“纳秒到微秒”级别。这得益于两个因素:一是编译时优化,表达式在编译时就已经被转换为高效的内部表示;二是 C++ 核心的性能优势,Python 版本封装了这个高性能核心。

编译表达式并重复使用的模式是发挥 CEL 性能优势的关键:

# 正确做法:编译一次,重复使用expr = env.compile("user.age >= 18")for user in users:    result = expr.eval(data={"user": user})  # 快速评估# 错误做法:每次都重新编译for user in users:    expr = env.compile("user.age >= 18")  # 浪费性能    result = expr.eval(data={"user": user})

总结

cel-expr-python 为 Python 开发者带来了谷歌在策略引擎领域的多年积累。它的核心价值在于将复杂的业务规则从代码中分离出来,以声明式的方式表达,同时保证了执行的安全性和性能。无论你是在做自动化测试、权限管理、配置验证,还是任何需要动态规则评估的场景,CEL 都值得你花时间了解。

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-04-17 12:03:32 HTTP/2.0 GET : https://f.mffb.com.cn/a/484094.html
  2. 运行时间 : 0.086648s [ 吞吐率:11.54req/s ] 内存消耗:5,128.47kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=914fe58e2cc16f8ecb328d95fa61921e
  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.000506s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000602s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000275s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000272s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000486s ]
  6. SELECT * FROM `set` [ RunTime:0.000238s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000576s ]
  8. SELECT * FROM `article` WHERE `id` = 484094 LIMIT 1 [ RunTime:0.000584s ]
  9. UPDATE `article` SET `lasttime` = 1776398612 WHERE `id` = 484094 [ RunTime:0.008051s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000730s ]
  11. SELECT * FROM `article` WHERE `id` < 484094 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000556s ]
  12. SELECT * FROM `article` WHERE `id` > 484094 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000616s ]
  13. SELECT * FROM `article` WHERE `id` < 484094 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.001492s ]
  14. SELECT * FROM `article` WHERE `id` < 484094 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.001203s ]
  15. SELECT * FROM `article` WHERE `id` < 484094 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.003922s ]
0.088807s