当前位置:首页>python>Python 零基础100天—Day27 正则进阶

Python 零基础100天—Day27 正则进阶

  • 2026-07-01 08:35:35
Python 零基础100天—Day27 正则进阶

🐍 正则进阶 — 分组、编译与实战

🕐 预计用时:2-3 小时 | 🎯 目标:掌握分组、编译正则、贪婪深入、邮箱/手机验证实战


📖 今日目录

  1. 分组 () — 提取子匹配
  2. 命名分组 (?P<name>)
  3. 分组与 findall 的关系
  4. 非捕获分组 (?:)
  5. 贪婪/非贪婪深入
  6. 编译正则 re.compile
  7. re 标志位(flags)
  8. 实战:完整验证器
  9. 今日小结

1. 分组 () — 提取子匹配

圆括号 () 把正则分成"组"——不仅能整体匹配,还能单独提取每个部分。

import re

# 提取日期的年月日
text = "今天是 2024-01-15,明天是 2024-01-16"
pattern = r"(\d{4})-(\d{2})-(\d{2})"

for match in re.finditer(pattern, text):
    print(f"完整匹配: {match.group(0)}")  # 整个匹配
    print(f"  年: {match.group(1)}")      # 第1组
    print(f"  月: {match.group(2)}")      # 第2组
    print(f"  日: {match.group(3)}")      # 第3组
    print()

# 输出:
# 完整匹配: 2024-01-15
#   年: 2024
#   月: 01
#   日: 15
#
# 完整匹配: 2024-01-16
#   年: 2024
#   月: 01
#   日: 16
# group() 的用法
match = re.search(r"(\d{4})-(\d{2})-(\d{2})", "日期: 2024-01-15")

print(match.group(0))   # '2024-01-15'  完整匹配
print(match.group(1))   # '2024'        第1组
print(match.group(2))   # '01'          第2组
print(match.group(3))   # '15'          第3组
print(match.groups())   # ('2024', '01', '15')  所有组的元组
# 实用:解析 URL
url = "https://www.example.com:8080/path/to/page"
pattern = r"(https?)://([^/:]+)(?::(\d+))?(.*)"
match = re.match(pattern, url)

if match:
    print(f"协议: {match.group(1)}")   # https
    print(f"域名: {match.group(2)}")   # www.example.com
    print(f"端口: {match.group(3)}")   # 8080
    print(f"路径: {match.group(4)}")   # /path/to/page
# 实用:解析 CSV 行(简易版)
line = "张三,25,北京,工程师"
pattern = r"^(\w+),(\d+),(\w+),(\w+)$"
match = re.match(pattern, line)

if match:
    name, age, city, job = match.groups()
    print(f"姓名: {name}, 年龄: {age}, 城市: {city}, 职业: {job}")

💡 group 编号规则:
group(0) = 整个匹配(永远存在)
group(1) = 第1个括号里的内容
group(2) = 第2个括号里的内容
groups() = 所有组的元组(不含 group(0))


2. 命名分组 (?P<name>)

给分组起名字——用名字代替数字,代码更清晰。

# 普通分组:用数字访问
match = re.search(r"(\d{4})-(\d{2})-(\d{2})", "2024-01-15")
print(match.group(1))  # 2024(哪个是年?不直观)

# 命名分组:用名字访问
pattern = r"(?P<year>\d{4})-(?P<month>\d{2})-(?P<day>\d{2})"
match = re.search(pattern, "2024-01-15")
print(match.group("year"))   # 2024(一目了然!)
print(match.group("month"))  # 01
print(match.group("day"))    # 15

# 命名分组的字典
print(match.groupdict())     # {'year': '2024', 'month': '01', 'day': '15'}
# 实用:解析日志
log = "2024-01-15 08:30:15 [ERROR] 数据库连接失败"
pattern = r"(?P<date>\d{4}-\d{2}-\d{2}) (?P<time>\d{2}:\d{2}:\d{2}) \[(?P<level>\w+)\] (?P<msg>.+)"
match = re.match(pattern, log)

if match:
    info = match.groupdict()
    print(info)
    # {'date': '2024-01-15', 'time': '08:30:15', 'level': 'ERROR', 'msg': '数据库连接失败'}
# 实用:解析键值对
config = "host=localhost port=8080 debug=true"
pattern = r"(?P<key>\w+)=(?P<value>\w+)"
config_dict = {m.group("key"): m.group("value") for m in re.finditer(pattern, config)}
print(config_dict)  # {'host': 'localhost', 'port': '8080', 'debug': 'true'}

💡 命名分组的优势:
1. 代码可读性高(group("year") vs group(1)
2. groupdict() 直接生成字典
3. 正则模式变动时,不用改调用代码


3. 分组与 findall 的关系

findall 的行为取决于正则里有没有分组——这是个常见的坑!

# 没有分组:返回完整匹配的列表
result = re.findall(r"\d+", "a1b2c3")
print(result)  # ['1', '2', '3']

# 有1个分组:只返回该分组的内容
result = re.findall(r"(\d+)", "a1b2c3")
print(result)  # ['1', '2', '3'](和上面一样,但原因不同)

# 有多个分组:返回元组列表
result = re.findall(r"(\d+)-(\d+)", "1-2 3-4 5-6")
print(result)  # [('1', '2'), ('3', '4'), ('5', '6')]

# ⚠️ 常见坑:想提取完整匹配但加了分组
result = re.findall(r"(\d{4})-(\d{2})-(\d{2})", "2024-01-15 2024-02-20")
print(result)  # [('2024', '01'), ('2024', '02')] ← 只有分组内容!
# 期望是 ['2024-01-15', '2024-02-20'],但分组导致只返回组内容

# 解决方案:用非捕获分组 (?:) 或用 finditer
result = [m.group() for m in re.finditer(r"\d{4}-\d{2}-\d{2}", "2024-01-15 2024-02-20")]
print(result)  # ['2024-01-15', '2024-02-20']

⚠️ findall 分组陷阱:
有分组 → 只返回分组内容(元组)
无分组 → 返回完整匹配(字符串)
想要完整匹配 + 分组 → 用 finditer


4. 非捕获分组 (?:)

# (?:...) 分组但不捕获——不占用 group 编号

# 普通分组:占用编号
match = re.search(r"(https?)://([^/]+)", "https://example.com")
print(match.group(1))  # https(第1组)
print(match.group(2))  # example.com(第2组)

# 非捕获分组:不占用编号
match = re.search(r"(?:https?)://([^/]+)", "https://example.com")
print(match.group(1))  # example.com(现在是第1组了!)
# (?:https?) 匹配了但不产生编号

# 实用场景:OR 分组但不需要捕获
text = "color: red, colour: blue"
# 想匹配 color/colour 但不需要捕获
result = re.findall(r"(?:colou?r): (\w+)", text)
print(result)  # ['red', 'blue'](只有 (\w+) 的内容)
分组类型
语法
捕获
用途
普通分组
(...)
提取子匹配
命名分组
(?P<name>...)
按名字提取
非捕获分组
(?:...)
分组但不提取

5. 贪婪/非贪婪深入

# 贪婪:尽可能多匹配(默认)
text = "<div>Hello</div><div>World</div>"

# .* 贪婪:匹配到最后一个 </div>
print(re.findall(r"<div>.*</div>", text))
# ['<div>Hello</div><div>World</div>'](吞掉了中间的标签)

# .*? 非贪婪:匹配到最近的 </div>
print(re.findall(r"<div>.*?</div>", text))
# ['<div>Hello</div>', '<div>World</div>'](分别匹配)

# +? 非贪婪:至少1个,但尽量少
text = "aabab"
print(re.findall(r"a+?", text))   # ['a', 'a', 'a'](每次只匹配1个 a)
print(re.findall(r"a+", text))    # ['aa', 'a'](每次尽量多匹配)
# 实际场景:提取 HTML 标签内容
html = '<p class="title">Python 教程</p><p>Day 27</p>'

# 提取所有 <p> 标签内容
contents = re.findall(r"<p[^>]*>(.*?)</p>", html)
print(contents)  # ['Python 教程', 'Day 27']

# 提取标签属性
attrs = re.findall(r'<p\s+class="([^"]*)"', html)
print(attrs)     # ['title']
# 实际场景:提取引号内容
text = 'name="张三" age="25" city="北京"'
pairs = re.findall(r'(\w+)="([^"]*)"', text)
print(pairs)  # [('name', '张三'), ('age', '25'), ('city', '北京')]
print(dict(pairs))  # {'name': '张三', 'age': '25', 'city': '北京'}

💡 提取 HTML/引号内容的万能模式:
标签内容:<tag[^>]*>(.*?)</tag>
引号内容:attr="([^"]*)"
共同特点:用 [^X]* 排除法 + .*? 非贪婪


6. 编译正则 re.compile

同一个正则要多次使用时,先编译再用——更快、更清晰。

import re

# 不编译:每次都要解析正则字符串
re.findall(r"\d+", "abc123")
re.findall(r"\d+", "def456")
re.findall(r"\d+", "ghi789")

# 编译:只解析一次,多次复用
number_pattern = re.compile(r"\d+")
number_pattern.findall("abc123")
number_pattern.findall("def456")
number_pattern.findall("ghi789")
# 编译后的方法和 re 模块的方法一样
pattern = re.compile(r"(\d{4})-(\d{2})-(\d{2})")

# match
m = pattern.match("2024-01-15 hello")
print(m.groups())  # ('2024', '01', '15')

# search
m = pattern.search("date: 2024-01-15")
print(m.group())   # 2024-01-15

# findall
dates = pattern.findall("2024-01-15 to 2024-02-20")
print(dates)       # [('2024', '01', '15'), ('2024', '02', '20')]

# sub
result = pattern.sub(r"\1/\2/\3", "date: 2024-01-15")
print(result)      # date: 2024/01/15
# 编译时加标志位
pattern = re.compile(r"hello", re.IGNORECASE)
print(pattern.findall("Hello HELLO hello"))  # ['Hello', 'HELLO', 'hello']

# 多个标志位用 | 连接
pattern = re.compile(r"^hello$", re.IGNORECASE | re.MULTILINE)

💡 何时用 compile?
1. 同一个正则要用 3 次以上 → 编译
2. 只用一两次 → 直接 re.xxx()
3. 编译不影响结果,只影响性能和可读性


7. re 标志位(flags)

标志
缩写
作用
re.IGNORECASEre.I
忽略大小写
re.MULTILINEre.M^
 和 $ 匹配每行
re.DOTALLre.S.
 也匹配换行符
re.VERBOSEre.X
允许正则里加注释和空格
import re

# re.I — 忽略大小写
print(re.findall(r"python", "Python PYTHON python", re.I))
# ['Python', 'PYTHON', 'python']

# re.M — 多行模式(^ 和 $ 匹配每行的开头和结尾)
text = """第一行
第二行
第三行"""
print(re.findall(r"^第.*行$", text, re.M))
# ['第一行', '第二行', '第三行']

# re.S — 让 . 也匹配换行符
text = "<div>\nHello\n</div>"
print(re.findall(r"<div>(.*)</div>", text))       # [](默认 . 不匹配换行)
print(re.findall(r"<div>(.*)</div>", text, re.S))  # ['\nHello\n']

# re.X — 详细模式(可以加注释)
phone_pattern = re.compile(r"""
    ^                   # 开头
    1                   # 第一位是1
    [3-9]               # 第二位是3-9
    \d{9}               # 后面9位数字
    $                   # 结尾
""", re.VERBOSE)

print(phone_pattern.match("13800138000"))  # 匹配成功

8. 实战:完整验证器

import re

class Validator:
    """数据验证器:用编译正则实现"""

    # 编译所有正则(只执行一次)
    PHONE = re.compile(r"^1[3-9]\d{9}$")
    EMAIL = re.compile(r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$")
    ID_CARD = re.compile(r"^[1-9]\d{5}(19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$")
    URL = re.compile(r"^https?://[^\s/$.?#].[^\s]*$", re.I)
    IP = re.compile(r"^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$")
    DATE = re.compile(r"^(?:\d{4})-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|02-(?:0[1-9]|1\d|2[0-8]))$|^(?:\d{4})-(?:02)-(?:29)$")
    USERNAME = re.compile(r"^[a-zA-Z][a-zA-Z0-9_]{3,15}$")
    PASSWORD = re.compile(r"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*])[A-Za-z\d!@#$%^&*]{8,20}$")
    PLATE = re.compile(r"^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤川青藏琼宁][A-Z][A-HJ-NP-Z0-9]{4,5}[A-HJ-NP-Z0-9挂学警港澳]$")

    @classmethod
    def phone(cls, value):
        """验证手机号"""
        return bool(cls.PHONE.match(str(value)))

    @classmethod
    def email(cls, value):
        """验证邮箱"""
        return bool(cls.EMAIL.match(str(value)))

    @classmethod
    def id_card(cls, value):
        """验证身份证号"""
        return bool(cls.ID_CARD.match(str(value)))

    @classmethod
    def url(cls, value):
        """验证 URL"""
        return bool(cls.URL.match(str(value)))

    @classmethod
    def ip(cls, value):
        """验证 IP 地址"""
        return bool(cls.IP.match(str(value)))

    @classmethod
    def username(cls, value):
        """验证用户名:字母开头,4-16位,字母数字下划线"""
        return bool(cls.USERNAME.match(str(value)))

    @classmethod
    def password(cls, value):
        """验证密码:8-20位,含大小写+数字+特殊字符"""
        return bool(cls.PASSWORD.match(str(value)))

    @classmethod
    def date(cls, value):
        """验证日期(含闰年)"""
        return bool(cls.DATE.match(str(value)))

    @classmethod
    def validate_all(cls, data):
        """批量验证"""
        validators = {
            "phone": cls.phone,
            "email": cls.email,
            "id_card": cls.id_card,
            "username": cls.username,
            "password": cls.password,
        }
        results = {}
        for field, value in data.items():
            if field in validators:
                results[field] = {
                    "value": value,
                    "valid": validators[field](value),
                }
        return results

# 测试
tests = [
    ("手机号", "13800138000", Validator.phone),
    ("手机号", "12345678901", Validator.phone),
    ("邮箱", "test@example.com", Validator.email),
    ("邮箱", "invalid@", Validator.email),
    ("身份证", "110101199003076531", Validator.id_card),
    ("URL", "https://www.example.com/path?q=1", Validator.url),
    ("IP", "192.168.1.100", Validator.ip),
    ("IP", "256.1.1.1", Validator.ip),
    ("用户名", "alice_123", Validator.username),
    ("用户名", "1abc", Validator.username),
    ("密码", "MyP@ss123", Validator.password),
    ("密码", "weak", Validator.password),
    ("日期", "2024-02-29", Validator.date),
    ("日期", "2023-02-29", Validator.date),
    ("车牌", "京A12345", Validator.plate if hasattr(Validator, 'plate') else lambda x: True),
]

print("🔍 验证测试结果:")
for label, value, func in tests:
    status = "✅" if func(value) else "❌"
    print(f"  {status} {label:6s}: {value}")

# 批量验证
print("\n📋 批量验证:")
data = {
    "username": "alice_123",
    "password": "MyP@ss123",
    "email": "alice@test.com",
    "phone": "13800138000",
}
results = Validator.validate_all(data)
for field, info in results.items():
    status = "✅" if info["valid"] else "❌"
    print(f"  {status} {field}: {info['value']}")

9. 今日小结

知识点
核心内容
分组 ()
group(1)
 提取子匹配,groups() 获取所有组
命名分组
(?P<name>...)
group("name")groupdict()
非捕获分组
(?:...)
,分组但不占用编号
findall 分组陷阱
有分组→只返回分组内容,无分组→返回完整匹配
贪婪/非贪婪
.*
贪婪 vs .*?非贪婪,提取 HTML 用非贪婪
编译正则
re.compile()
,多次使用时更快更清晰
标志位
re.I
忽略大小写 re.M多行 re.S匹配换行 re.X注释

🧠 记忆口诀:
圆括号分组,group 拿内容。
尖括号命名,groupdict 变字典。
问号冒号非捕获,分组不占编号位。
星号加号默认贪,问号一加变懒人。
compile 编译快,I M S X 标志位。

🔮 预告: Day 28 JSON 处理 — json.loads/dumps、嵌套结构、与文件交互、API 数据解析。数据交换的标准格式!

轻松时刻:

请在微信客户端打开

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-03 00:59:04 HTTP/2.0 GET : https://f.mffb.com.cn/a/497874.html
  2. 运行时间 : 0.166722s [ 吞吐率:6.00req/s ] 内存消耗:4,474.52kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=6f20174b304d3865d1a52c38081825eb
  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.000743s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000836s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.001854s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.003343s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000540s ]
  6. SELECT * FROM `set` [ RunTime:0.000271s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000583s ]
  8. SELECT * FROM `article` WHERE `id` = 497874 LIMIT 1 [ RunTime:0.016441s ]
  9. UPDATE `article` SET `lasttime` = 1783011544 WHERE `id` = 497874 [ RunTime:0.001153s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000331s ]
  11. SELECT * FROM `article` WHERE `id` < 497874 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.001863s ]
  12. SELECT * FROM `article` WHERE `id` > 497874 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000402s ]
  13. SELECT * FROM `article` WHERE `id` < 497874 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.000868s ]
  14. SELECT * FROM `article` WHERE `id` < 497874 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.015054s ]
  15. SELECT * FROM `article` WHERE `id` < 497874 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.052145s ]
0.168919s