当前位置:首页>python>Python 零基础100天—Day26 正则表达式基础

Python 零基础100天—Day26 正则表达式基础

  • 2026-07-01 19:41:04
Python 零基础100天—Day26 正则表达式基础

🐍 正则表达式基础 — 文本处理的瑞士军刀

🕐 预计用时:2-3 小时 | 🎯 目标:掌握 re 模块、元字符、match/search/findall


📖 今日目录

  1. 什么是正则表达式?
  2. re 模块入门
  3. 基础元字符
  4. 字符类 []
  5. 量词
  6. 位置锚点
  7. 常用函数:match/search/findall
  8. 实战练习
  9. 今日小结

1. 什么是正则表达式?

正则表达式(Regular Expression,简称 regex)是一种"模式匹配语言"——用特殊符号描述文本模式,然后从海量文本中精准提取你想要的内容。

# 没有正则:手动逐字符判断
text = "我的手机号是13800138000,他的号码是13912345678"
# 想提取手机号?手动写代码逐字符判断?太累了!

# 有正则:一行搞定
import re
phones = re.findall(r"1[3-9]\d{9}", text)
print(phones)  # ['13800138000', '13912345678']
场景
示例
验证手机号
1[3-9]\d{9}
验证邮箱
\w+@\w+\.\w+
提取日期
\d{4}-\d{2}-\d{2}
替换敏感词
re.sub("敏感词", "***", text)
分割字符串
re.split(r"[,;\s]", text)

2. re 模块入门

import re

# 最简单的正则:普通字符匹配自己
result = re.search(r"hello", "say hello to python")
print(result)        # <re.Match object; span=(4, 9), match='hello'>
print(result.group()) # hello
print(result.start()) # 4(匹配的起始位置)
print(result.end())   # 9(匹配的结束位置)

💡 r 前缀是什么?
r"hello" 是"原始字符串"——反斜杠不被转义。
正则里大量用 \,不加 r 的话 \d 要写成 \\d,太丑了。
写正则永远加 r 前缀!


3. 基础元字符

元字符
含义
示例
匹配
.
任意一个字符(除换行)
a.c
"abc", "a1c", "a@c"
\d
数字 [0-9]
a\db
"a1b", "a9b"
\D
非数字 [^0-9]
a\Db
"a_b", "a b"
\w
字母/数字/下划线
\w+
"hello_123"
\W
非字母数字下划线
\W+
"@#$"
\s
空白字符
a\sb
"a b", "a\tb"
\S
非空白字符
a\Sb
"a1b", "a_b"
\\
转义特殊字符
a\.b
"a.b"(不是任意字符)
import re

# . 匹配任意一个字符
print(re.findall(r"a.c", "abc a1c a@c a\nc"))  # ['abc', 'a1c', 'a@c'](不含换行)

# \d 匹配数字
print(re.findall(r"\d+", "今天是2024年1月15日"))  # ['2024', '1', '15']

# \w 匹配字母数字下划线
print(re.findall(r"\w+", "hello_world 123 @#$"))  # ['hello_world', '123']

# \s 匹配空白
print(re.findall(r"\s+", "a  b\tc\nd"))  # ['  ', '\t', '\n']

# 转义特殊字符
print(re.findall(r"a\.b", "a.b acb a1b"))  # ['a.b'](只匹配字面意义的点)

4. 字符类 []

方括号定义"可选字符集"——匹配其中任意一个字符。

# [abc] — 匹配 a 或 b 或 c
print(re.findall(r"[abc]", "apple banana cherry"))  # ['a', 'b', 'a', 'a', 'a', 'c']

# [a-z] — 匹配 a 到 z 的任意小写字母
print(re.findall(r"[a-z]+", "Hello World 123"))  # ['ello', 'orld']

# [A-Za-z] — 匹配所有字母
print(re.findall(r"[A-Za-z]+", "Hello World 123"))  # ['Hello', 'World']

# [0-9] — 等价于 \d
print(re.findall(r"[0-9]+", "abc123def456"))  # ['123', '456']

# [^...] — 取反(不匹配这些字符)
print(re.findall(r"[^0-9]+", "abc123def456"))  # ['abc', 'def']

# 常用字符类简写
# [0-9]  → \d
# [a-zA-Z0-9_] → \w
# [ \t\n\r\f\v] → \s
# 实用示例

# 提取中文
text = "Hello 你好 World 世界 123"
chinese = re.findall(r"[\u4e00-\u9fa5]+", text)
print(chinese)  # ['你好', '世界']

# 匹配手机号前缀(1开头,第二位是3-9)
print(re.findall(r"1[3-9]\d{9}", "13800138000 12345 15912345678"))
# ['13800138000', '15912345678']

# 匹配十六进制颜色值
text = "背景色是 
#FF5733,前景色是 #00AACC"
colors = re.findall(r"#[0-9A-Fa-f]{6}", text)
print(colors)  # ['#FF5733', '#00AACC']

5. 量词

量词控制前面的元素重复几次。

量词
含义
示例
匹配
*
0 次或多次
ab*c
"ac", "abc", "abbc"
+
1 次或多次
ab+c
"abc", "abbc"(不含"ac")
?
0 次或 1 次
ab?c
"ac", "abc"(不含"abbc")
{n}
恰好 n 次
a{3}
"aaa"
{n,}
至少 n 次
a{2,}
"aa", "aaa", "aaaa"...
{n,m}
n 到 m 次
a{2,4}
"aa", "aaa", "aaaa"
import re

# * 零次或多次
print(re.findall(r"ab*c", "ac abc abbc abbbc"))  # ['ac', 'abc', 'abbc', 'abbbc']

# + 一次或多次
print(re.findall(r"ab+c", "ac abc abbc abbbc"))  # ['abc', 'abbc', 'abbbc']

# ? 零次或一次
print(re.findall(r"colou?r", "color colour"))  # ['color', 'colour']

# {n} 恰好 n 次
print(re.findall(r"\d{3}", "12 345 6789 12345"))  # ['345', '678', '123']

# {n,m} n 到 m 次
print(re.findall(r"\d{2,4}", "1 12 123 1234 12345"))
# ['12', '123', '1234', '1234', '5'] → 注意 12345 被拆成 1234 和 5

⚡ 贪婪 vs 非贪婪

# 默认是贪婪模式(尽可能多匹配)
text = "<div>hello</div><div>world</div>"

# 贪婪:尽可能多匹配
greedy = re.findall(r"<div>.*</div>", text)
print(greedy)  # ['<div>hello</div><div>world</div>'](匹配了全部)

# 非贪婪:加 ? 尽可能少匹配
lazy = re.findall(r"<div>.*?</div>", text)
print(lazy)    # ['<div>hello</div>', '<div>world</div>'](分别匹配)

💡 贪婪 vs 非贪婪:
贪婪:.*.+.{n,m} — 尽可能多匹配
非贪婪:.*?.+?.{n,m}? — 加个 ? 就变非贪婪
提取 HTML 标签内容时,几乎 always 用非贪婪!


6. 位置锚点

# ^ — 字符串开头
print(re.findall(r"^hello", "hello world"))   # ['hello']
print(re.findall(r"^world", "hello world"))   # [](不在开头)

# $ — 字符串结尾
print(re.findall(r"world$", "hello world"))   # ['world']
print(re.findall(r"hello$", "hello world"))   # [](不在结尾)

# \b — 单词边界
print(re.findall(r"\bcat\b", "cat category scatter"))
# ['cat'](只匹配独立的 cat,不匹配 category 和 scatter)

print(re.findall(r"\bpython\b", "python3 python snake"))
# ['python'](只匹配独立的 python)

# 实用:验证整个字符串是否匹配
# 完全匹配(^开头 $结尾)
print(bool(re.match(r"^\d{6}$", "123456")))   # True(6位数字)
print(bool(re.match(r"^\d{6}$", "12345")))    # False(5位)
print(bool(re.match(r"^\d{6}$", "1234567")))  # False(7位)

7. 常用函数

🔍 re.match — 从开头匹配

# match 只从字符串开头匹配
result = re.match(r"\d+", "123abc")
print(result.group())  # 123

result = re.match(r"\d+", "abc123")
print(result)  # None(开头不是数字)

🔍 re.search — 搜索第一个匹配

# search 搜索整个字符串,返回第一个匹配
result = re.search(r"\d+", "abc123def456")
print(result.group())  # 123(第一个匹配)

# 没找到返回 None
result = re.search(r"\d+", "no numbers here")
print(result)  # None

🔍 re.findall — 找到所有匹配

# findall 返回所有匹配的列表
result = re.findall(r"\d+", "abc123def456ghi789")
print(result)  # ['123', '456', '789']

# 提取所有邮箱
text = "联系 zhang@test.com 或 li@example.org"
emails = re.findall(r"\w+@\w+\.\w+", text)
print(emails)  # ['zhang@test.com', 'li@example.org']

🔍 re.finditer — 返回迭代器

# finditer 返回 Match 对象的迭代器(大文本更高效)
for match in re.finditer(r"\d+", "abc123def456"):
    print(f"找到 '{match.group()}' 在位置 {match.start()}-{match.end()}")
# 找到 '123' 在位置 3-6
# 找到 '456' 在位置 9-12

🔄 re.sub — 替换

# sub 替换匹配的内容
result = re.sub(r"\d+", "***", "电话13800138000,邮编100000")
print(result)  # 电话***,邮编***

# 用函数替换
def double_number(match):
    return str(int(match.group()) * 2)

result = re.sub(r"\d+", double_number, "a1 b2 c3")
print(result)  # 'a2 b4 c6'

✂️ re.split — 分割

# 按多种分隔符分割
result = re.split(r"[,;\s]+", "apple, banana; cherry  date")
print(result)  # ['apple', 'banana', 'cherry', 'date']

📋 re 完整函数速查表

函数
作用
返回值
re.match(p, s)
从开头匹配
Match 或 None
re.search(p, s)
搜索第一个
Match 或 None
re.findall(p, s)
找所有
字符串列表
re.finditer(p, s)
找所有(迭代器)
Match 迭代器
re.sub(p, r, s)
替换
新字符串
re.split(p, s)
分割
字符串列表
re.compile(p)
编译正则
Pattern 对象

8. 实战练习

🎯 练习 1:手机号/邮箱/身份证验证器

import re

def validate_phone(phone):
    """验证手机号"""
    pattern = r"^1[3-9]\d{9}$"
    return bool(re.match(pattern, phone))

def validate_email(email):
    """验证邮箱"""
    pattern = r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"
    return bool(re.match(pattern, email))

def validate_id_card(id_card):
    """验证身份证号(18位)"""
    pattern = 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]$"
    return bool(re.match(pattern, id_card))

# 测试
tests = [
    ("13800138000", "手机号", validate_phone),
    ("12345678901", "手机号", validate_phone),
    ("zhang@test.com", "邮箱", validate_email),
    ("invalid@", "邮箱", validate_email),
    ("110101199003076531", "身份证", validate_id_card),
]

for value, label, func in tests:
    status = "✅" if func(value) else "❌"
    print(f"  {status} {label}: {value}")

🎯 练习 2:文本信息提取器

import re

def extract_info(text):
    """从文本中提取各种信息"""
    info = {}

    # 手机号
    info["phones"] = re.findall(r"1[3-9]\d{9}", text)

    # 邮箱
    info["emails"] = re.findall(r"\w+@\w+\.\w+", text)

    # 日期
    info["dates"] = re.findall(r"\d{4}[-/]\d{1,2}[-/]\d{1,2}", text)

    # URL
    info["urls"] = re.findall(r"https?://\S+", text)

    # IP 地址
    info["ips"] = re.findall(r"\b(?:\d{1,3}\.){3}\d{1,3}\b", text)

    # 中文字符
    info["chinese"] = re.findall(r"[\u4e00-\u9fa5]+", text)

    # 数字
    info["numbers"] = re.findall(r"\b\d+\.?\d*\b", text)

    return info

# 测试
text = """
联系张三:手机13800138000,邮箱zhangsan@company.com
访问 https://www.example.com 获取更多信息
服务器地址:192.168.1.100
日期:2024-01-15,价格 99.5 元
"""

info = extract_info(text)
for key, values in info.items():
    if values:
        print(f"  {key}: {values}")

🎯 练习 3:日志解析器

import re
from collections import Counter

def parse_log(log_text):
    """解析日志并统计"""
    # 匹配日志格式:[时间] [级别] 消息
    pattern = r"\[(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})\] \[(\w+)\] (.+)"

    records = []
    for match in re.finditer(pattern, log_text):
        records.append({
            "time": match.group(1),
            "level": match.group(2),
            "message": match.group(3),
        })

    # 统计各级别数量
    level_count = Counter(r["level"] for r in records)

    # 提取所有 IP 地址
    ips = re.findall(r"\b(?:\d{1,3}\.){3}\d{1,3}\b", log_text)

    # 提取所有错误消息
    errors = [r["message"] for r in records if r["level"] == "ERROR"]

    return {
        "records": records,
        "level_count": level_count,
        "ips": list(set(ips)),
        "errors": errors,
    }

log_text = """
[2024-01-15 08:30:15] [INFO] 用户登录 192.168.1.100
[2024-01-15 08:31:22] [INFO] 页面访问 /home
[2024-01-15 08:35:45] [ERROR] 数据库连接失败 10.0.0.50
[2024-01-15 09:00:12] [WARNING] 磁盘使用率 85%
[2024-01-15 09:15:33] [ERROR] API 超时 /api/users
[2024-01-15 10:00:00] [INFO] 定时任务完成
"""

result = parse_log(log_text)
print(f"📊 日志解析结果:")
print(f"  总记录: {len(result['records'])}")
print(f"  级别统计: {dict(result['level_count'])}")
print(f"  IP地址: {result['ips']}")
print(f"  错误消息: {result['errors']}")

9. 今日小结

知识点
核心内容
元字符
.
任意 \d数字 \w字母 \s空白
字符类
[abc]
选一 [a-z]范围 [^abc]取反
量词
*
0+ +1+ ?0/1 {n,m}范围
贪婪/非贪婪
.*
贪婪 vs .*?非贪婪
锚点
^
开头 $结尾 \b单词边界
match
从开头匹配
search
搜索第一个
findall
找所有(列表)
sub
替换
split
分割

🧠 记忆口诀:
反斜杠 d 是数字,w 字母 s 空白。
大写取反 D 非数,W 非字母 S 非空。
星号零或多,加号一或多。
问号零或一,贪婪加问号。
match 开头找,search 全文搜。
findall 拿全部,sub 来替换。

🔮 预告: Day 27 正则进阶 — 分组、贪婪/非贪婪深入、编译正则、实际应用(邮箱/手机验证)。正则的高级玩法!

轻松时刻:

请在微信客户端打开

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-03 00:56:38 HTTP/2.0 GET : https://f.mffb.com.cn/a/497683.html
  2. 运行时间 : 0.525604s [ 吞吐率:1.90req/s ] 内存消耗:4,404.50kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=63df3a5546847aff302b04413a1b434d
  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.000494s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000803s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.005427s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000679s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000743s ]
  6. SELECT * FROM `set` [ RunTime:0.007336s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000786s ]
  8. SELECT * FROM `article` WHERE `id` = 497683 LIMIT 1 [ RunTime:0.062734s ]
  9. UPDATE `article` SET `lasttime` = 1783011398 WHERE `id` = 497683 [ RunTime:0.027096s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.008792s ]
  11. SELECT * FROM `article` WHERE `id` < 497683 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.051675s ]
  12. SELECT * FROM `article` WHERE `id` > 497683 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.083871s ]
  13. SELECT * FROM `article` WHERE `id` < 497683 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.183473s ]
  14. SELECT * FROM `article` WHERE `id` < 497683 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.010901s ]
  15. SELECT * FROM `article` WHERE `id` < 497683 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.004341s ]
0.527230s