当前位置:首页>python>Python xml模块详细介绍

Python xml模块详细介绍

  • 2026-01-31 05:02:34
Python xml模块详细介绍

1. 创始时间与作者

  • 创始时间XML(eXtensible Markup Language)由 W3C(万维网联盟)于 1998年2月10日 发布 1.0 版本

  • 核心开发者

    • World Wide Web Consortium (W3C):标准化组织,负责XML规范的制定和维护

    • XML工作组:由来自IBM、Microsoft、Sun等公司的专家组成

    • Tim Bray:XML规范的主要编辑之一,对XML设计有重要贡献

  • 项目定位:一种用于标记电子文件使其具有结构性的标记语言,设计用来传输和存储数据

2. 官方资源

  • W3C官方规范https://www.w3.org/XML/

  • XML 1.0规范https://www.w3.org/TR/xml/

  • Python xml模块文档https://docs.python.org/3/library/xml.html

3. 核心功能

4. 应用场景

1. 配置文件解析
import xml.etree.ElementTree as ET# 解析XML配置文件tree = ET.parse('config.xml')root = tree.getroot()# 读取配置值database_host = root.find('database/host').textdatabase_port = root.find('database/port').textapp_settings = {elem.tagelem.text for elem in root.find('settings')}print(f"数据库: {database_host}:{database_port}")print(f"应用设置: {app_settings}")# config.xml 示例:"""<config>    <database>        <host>localhost</host>        <port>3306</port>    </database>    <settings>        <debug>true</debug>        <log_level>INFO</log_level>    </settings></config>"""
2. Web服务数据交换
import xml.etree.ElementTree as ETimport requests# 创建SOAP请求def create_soap_request():envelope = ET.Element('soap:Envelope')envelope.set('xmlns:soap''http://schemas.xmlsoap.org/soap/envelope/')body = ET.SubElement(envelope'soap:Body')get_weather = ET.SubElement(body'GetWeather')get_weather.set('xmlns''http://example.com/weather')city = ET.SubElement(get_weather'City')city.text = 'Beijing'return ET.tostring(envelopeencoding='unicode')# 发送SOAP请求soap_request = create_soap_request()response = requests.post('http://example.com/weather/service',data=soap_request,headers={'Content-Type''text/xml'})# 解析SOAP响应root = ET.fromstring(response.content)temperature = root.find('.//{http://example.com/weather}Temperature').textprint(f"当前温度: {temperature}°C")
3. 数据序列化
import xml.etree.ElementTree as ETfrom dataclasses import dataclassfrom typing import List@dataclassclass Person:namestrageintemailstrdef persons_to_xml(personsList[Person]) ->str:"""将Person对象列表转换为XML"""root = ET.Element('Persons')for person in persons:person_elem = ET.SubElement(root'Person')name_elem = ET.SubElement(person_elem'Name')name_elem.text = person.nameage_elem = ET.SubElement(person_elem'Age')age_elem.text = str(person.age)email_elem = ET.SubElement(person_elem'Email')email_elem.text = person.emailreturn ET.tostring(rootencoding='unicode'method='xml')# 使用示例persons = [Person("Alice"30"alice@example.com"),Person("Bob"25"bob@example.com")]xml_data = persons_to_xml(persons)print(xml_data)
4. RSS订阅处理
import xml.etree.ElementTree as ETimport requestsfrom datetime import datetimedef parse_rss_feed(url):"""解析RSS订阅源"""response = requests.get(url)root = ET.fromstring(response.content)# RSS 2.0 命名空间ns = {''''}channel = root.find('channel')feed_title = channel.find('title').textitems = []for item in channel.findall('item'):items.append({'title'item.find('title').text,'link'item.find('link').text,'description'item.find('description').text,'pubDate'datetime.strptime(item.find('pubDate').text'%a, %d %b %Y %H:%M:%S %z')        })return {'title'feed_title'items'items}# 使用示例rss_url = "https://example.com/rss"feed = parse_rss_feed(rss_url)print(f"订阅源: {feed['title']}")for item in feed['items'][:3]:  # 显示最新3条print(f"- {item['title']} ({item['pubDate'].strftime('%Y-%m-%d')})")

5. 底层逻辑与技术原理

核心架构
关键技术
  1. DOM解析

    • 一次性加载整个XML文档到内存

    • 构建树形结构,支持随机访问

    • 适合小型文档和需要频繁修改的场景

  2. SAX解析

    • 基于事件驱动的流式解析

    • 逐行读取,内存占用小

    • 适合大型文档和只读操作

  3. ElementTree解析

    • Python特有的轻量级解析方式

    • 平衡DOM和SAX的优点

    • 提供简洁的API接口

  4. XML验证

    • DTD(文档类型定义)验证

    • XML Schema验证

    • 支持命名空间处理


6. 安装与配置

安装说明
# xml模块是Python标准库的一部分,无需单独安装# 从Python 1.5+开始内置支持# 检查Python版本python --version# 导入测试python -c"import xml.etree.ElementTree as ET; print('XML模块可用')"
可选依赖
# 如果需要额外的XML功能,可以安装以下库:# lxml (高性能XML处理)pip install lxml# xmlschema (XML Schema验证)pip install xmlschema# defusedxml (安全的XML解析)pip install defusedxml
环境要求
组件最低要求推荐配置
Python1.5+3.8+
内存视XML文件大小而定充足内存处理大文件
性能基础性能无特殊要求
版本兼容性
Python版本xml模块功能支持
1.5+基本XML解析功能
2.0+更完善的XML支持
2.5+ElementTree API
3.0+改进的Unicode支持
3.8+最新的安全增强

7. 性能特点

解析方式内存使用性能适用场景
DOM解析高(整个文档加载到内存)中等小型文档,需要随机访问
SAX解析低(流式处理)大型文档,只读操作
ElementTree中等大多数应用场景
lxml中等非常高高性能需求

注:性能特征基于典型使用场景,实际性能受文档结构和硬件影响


8. 高级功能使用

1. 命名空间处理
import xml.etree.ElementTree as ET# 处理带命名空间的XMLxml_data = """<root xmlns:app="http://example.com/app"      xmlns:user="http://example.com/user">    <app:settings>        <app:timeout>30</app:timeout>    </app:settings>    <user:info>        <user:name>Alice</user:name>        <user:age>30</user:age>    </user:info></root>"""# 注册命名空间ns = {'app''http://example.com/app','user''http://example.com/user'}root = ET.fromstring(xml_data)# 使用命名空间查找元素timeout = root.find('app:settings/app:timeout'ns)user_name = root.find('user:info/user:name'ns)print(f"超时: {timeout.text}")print(f"用户名: {user_name.text}")# 创建带命名空间的元素new_settings = ET.Element('{%s}new_settings'%ns['app'])new_settings.set('{%s}version'%ns['app'], '1.0')root.append(new_settings)
2. XML验证
from xml.etree.ElementTree import parseXMLParserfrom xml.parsers.expat import ExpatErrordef validate_xml(xml_filedtd_file=None):"""验证XML文件的有效性"""try:# 基本XML格式验证parser = XMLParser()tree = parse(xml_fileparser=parser)# 如果有DTD,进行DTD验证if dtd_file:# 需要lxml库进行DTD验证try:from lxml import etreexmlschema_doc = etree.parse(dtd_file)xmlschema = etree.XMLSchema(xmlschema_doc)xml_doc = etree.parse(xml_file)return xmlschema.validate(xml_doc)except ImportError:print("警告: 需要安装lxml库进行DTD验证")return Truereturn Trueexcept ExpatError as e:print(f"XML格式错误: {e}")return Falseexcept Exception as e:print(f"验证错误: {e}")return False# 使用示例is_valid = validate_xml('data.xml''schema.dtd')print(f"XML验证结果: {'通过' if is_valid else '失败'}")
3. XPath查询
import xml.etree.ElementTree as ET# 加载XML数据tree = ET.parse('books.xml')root = tree.getroot()# 注册命名空间(如果有)ns = {''''}  # 无命名空间# 使用XPath查询# 查找所有价格大于20的书expensive_books = root.findall(".//book[price>20]")print("昂贵的书籍:")for book in expensive_books:title = book.find('title').textprice = book.find('price').textprint(f"- {title}: ${price}")# 查找特定作者的书author_books = root.findall(".//book[author='J.K. Rowling']")print("\nJ.K. Rowling的书籍:")for book in author_books:title = book.find('title').textprint(f"- {title}")# 使用通配符all_titles = root.findall(".//title")print(f"\n总共找到 {len(all_titles)} 本书")
4. 大型XML文件处理
import xml.etree.ElementTree as ETfrom memory_profiler import profile@profiledef process_large_xml(xml_fileoutput_file):"""处理大型XML文件(内存高效方式)"""# 使用迭代解析context = ET.iterparse(xml_fileevents=('start''end'))# 转为迭代器context = iter(context)# 获取根元素eventroot = next(context)with open(output_file'w'encoding='utf-8'as out_f:out_f.write('<?xml version="1.0" encoding="UTF-8"?>\n')out_f.write(f'<{root.tag}>\n')for eventelem in context:if event == 'end' and elem.tag == 'record':# 处理每个记录processed_data = process_record(elem)out_f.write(processed_data+'\n')# 清理已处理元素elem.clear()if elem.getprevious() is not None:del elem.getparent()[0]out_f.write(f'</{root.tag}>\n')# 最后清理根元素root.clear()def process_record(record_elem):"""处理单个记录元素"""# 提取需要的数据data = {}for child in record_elem:data[child.tag] = child.text# 转换为需要的格式return f"<processed>{data['id']}:{data['value']}</processed>"# 使用示例process_large_xml('large_data.xml''processed_data.xml')

9. 安全注意事项

XML安全风险
from defusedxml.ElementTree import parse as safe_parseimport xml.etree.ElementTree as ETdef safe_xml_parsing(xml_data):"""安全的XML解析"""try:# 使用defusedxml防止XXE攻击root = safe_parse(xml_data).getroot()return process_xml(root)except Exception as e:print(f"安全解析错误: {e}")return Nonedef dangerous_xml_parsing(xml_data):"""不安全的XML解析(仅用于演示)"""# 可能受到XXE攻击root = ET.fromstring(xml_data)return process_xml(root)# 安全配置解析器def create_secure_parser():"""创建安全的XML解析器"""parser = ET.XMLParser()# 禁用实体解析(防止XXE)parser.entity = {}return parser# 使用安全解析器secure_parser = create_secure_parser()try:tree = ET.parse('data.xml'parser=secure_parser)root = tree.getroot()except ET.ParseError as e:print(f"解析错误: {e}")
防御措施
# 1. 使用defusedxml库# pip install defusedxmlfrom defusedxml import defuse_stdlibdefuse_stdlib()# 2. 禁用危险功能parser = ET.XMLParser()parser.entity = {}  # 禁用实体parser.target = None# 禁用处理指令# 3. 输入验证和清理def sanitize_xml_input(xml_input):"""清理XML输入"""# 移除危险内容dangerous_patterns = [r'<!ENTITY.*?>',r'<!DOCTYPE.*?>',r'<?xml-stylesheet.*?>'    ]for pattern in dangerous_patterns:xml_input = re.sub(pattern''xml_inputflags=re.IGNORECASE)return xml_input

10. 实际应用案例

  1. Web服务集成

    # SOAP Web服务客户端import zeep# 使用zeep库处理SOAP(基于XML)client = zeep.Client('http://example.com/soap-service?wsdl')result = client.service.GetData(param1='value1')
  2. 配置文件管理

    # 应用配置管理class XMLConfig:def __init__(selfconfig_file):self.tree = ET.parse(config_file)self.root = self.tree.getroot()def get(selfkeydefault=None):elem = self.root.find(key)return elem.text if elem is not None else defaultdef set(selfkeyvalue):elem = self.root.find(key)if elem is None:elem = ET.SubElement(self.rootkey)elem.text = str(value)self.tree.write('config.xml')
  3. 数据交换格式

    # 与其他系统数据交换def export_to_xml(datafilename):root = ET.Element('DataExport')for item in data:record = ET.SubElement(root'Record')for keyvalue in item.items():field = ET.SubElement(recordkey)field.text = str(value)tree = ET.ElementTree(root)tree.write(filenameencoding='utf-8'xml_declaration=True)
  4. 文档生成

    # 生成XML格式的报表def generate_xml_report(datatemplate_file):# 使用模板生成标准化的XML报表tree = ET.parse(template_file)root = tree.getroot()# 填充数据fill_template(rootdata)# 美化输出indent(root)tree.write('report.xml'encoding='utf-8')

总结

XML是数据交换和存储的重要标准,核心价值在于:

  1. 结构化数据:提供清晰的数据结构表示

  2. 跨平台兼容:被几乎所有编程语言和平台支持

  3. 扩展性强:支持自定义标签和数据结构

  4. 标准丰富:拥有完整的生态系统(XSD、XSLT、XPath等)

技术亮点

  • 文本格式,人类可读

  • 强大的 schema 验证机制

  • 丰富的查询和转换工具

  • 广泛的标准支持

适用场景

  • 配置文件和数据存储

  • Web服务(SOAP、RESTful API)

  • 文档格式(Office Open XML、PDF)

  • 数据交换和集成

  • 内容管理系统

使用方式

import xml.etree.ElementTree as ET# Python标准库

学习资源

  • W3C XML规范:https://www.w3.org/XML/

  • Python xml文档:https://docs.python.org/3/library/xml.html

  • XML教程:https://www.w3schools.com/xml/

作为数据交换的标准格式,XML在企业和Web开发中仍然扮演着重要角色。Python的xml模块提供了完整的XML处理能力,遵循Python软件基金会许可证,可免费用于任何Python项目。

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-02-08 20:50:35 HTTP/2.0 GET : https://f.mffb.com.cn/a/464400.html
  2. 运行时间 : 0.249121s [ 吞吐率:4.01req/s ] 内存消耗:4,887.27kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=3ce17cd07c7418fda9c6fbe6653e7688
  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.001081s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001585s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.005491s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000951s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001344s ]
  6. SELECT * FROM `set` [ RunTime:0.000600s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001468s ]
  8. SELECT * FROM `article` WHERE `id` = 464400 LIMIT 1 [ RunTime:0.020436s ]
  9. UPDATE `article` SET `lasttime` = 1770555035 WHERE `id` = 464400 [ RunTime:0.004719s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000655s ]
  11. SELECT * FROM `article` WHERE `id` < 464400 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.001071s ]
  12. SELECT * FROM `article` WHERE `id` > 464400 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.005229s ]
  13. SELECT * FROM `article` WHERE `id` < 464400 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.008738s ]
  14. SELECT * FROM `article` WHERE `id` < 464400 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.015539s ]
  15. SELECT * FROM `article` WHERE `id` < 464400 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.052481s ]
0.250907s