跳到内容
当前位置:首页>Excel>Excel处理——pandas读写Excel

Excel处理——pandas读写Excel

  • 2026-11-09 22:57:33
Excel处理——pandas读写Excel

一、pandas Excel处理概述

pandas是Python数据分析的核心库,提供了强大的Excel读写功能,支持.xlsx和.xls格式。

import pandas as pd# 读取Exceldf = pd.read_excel('data.xlsx')print(df.head())# 写入Exceldf.to_excel('output.xlsx', index=False)

二、读取Excel文件

2.1 基本读取

import pandas as pd# 读取所有数据df = pd.read_excel('data.xlsx')print(df)# 读取指定工作表df = pd.read_excel('data.xlsx', sheet_name='Sheet1')df = pd.read_excel('data.xlsx', sheet_name=0)  # 索引# 读取多个工作表sheets = pd.read_excel('data.xlsx', sheet_name=['Sheet1', 'Sheet2'])sheets = pd.read_excel('data.xlsx', sheet_name=None)  # 所有工作表# 指定列作为索引df = pd.read_excel('data.xlsx', index_col=0)# 指定读取列df = pd.read_excel('data.xlsx', usecols=['姓名', '年龄'])df = pd.read_excel('data.xlsx', usecols='A:C')  # 列范围df = pd.read_excel('data.xlsx', usecols=[0, 1, 2])  # 列索引# 指定行df = pd.read_excel('data.xlsx', skiprows=2)  # 跳过前2行df = pd.read_excel('data.xlsx', nrows=10)  # 读取前10行

2.2 数据类型指定

import pandas as pd# 指定数据类型dtype = {'姓名': str,'年龄': int,'工资': float}df = pd.read_excel('data.xlsx', dtype=dtype)# 解析日期列df = pd.read_excel('data.xlsx', parse_dates=['日期'])df = pd.read_excel('data.xlsx', parse_dates=[1, 2])  # 列索引# 自定义日期解析df = pd.read_excel('data.xlsx',                    parse_dates=['日期'],                   date_parser=lambda x: pd.to_datetime(x, format='%Y-%m-%d'))# 处理缺失值df = pd.read_excel('data.xlsx', na_values=['NA', 'NULL', ''])# 处理千位分隔符df = pd.read_excel('data.xlsx', thousands=',')

2.3 处理大型Excel

import pandas as pd# 分块读取chunk_size = 1000chunks = pd.read_excel('large_data.xlsx', chunksize=chunk_size)for chunk in chunks:    process(chunk)  # 处理每个块# 只读取需要的列(节省内存)df = pd.read_excel('large_data.xlsx', usecols=['col1', 'col2', 'col3'])# 优化数据类型dtype = {'col1': 'int32','col2': 'float32','col3': 'category'}df = pd.read_excel('large_data.xlsx', dtype=dtype)

三、写入Excel文件

3.1 基本写入

import pandas as pd# 创建DataFramedata = {'姓名': ['张三', '李四', '王五'],'年龄': [25, 30, 28],'城市': ['北京', '上海', '广州']}df = pd.DataFrame(data)# 写入单个工作表df.to_excel('output.xlsx', index=False)# 指定工作表名df.to_excel('output.xlsx', sheet_name='人员信息', index=False)# 不包含索引df.to_excel('output.xlsx', index=False)# 指定列df.to_excel('output.xlsx', columns=['姓名', '城市'], index=False)

3.2 写入多个工作表

import pandas as pd# 创建多个DataFramedf1 = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]})df2 = pd.DataFrame({'C': [7, 8, 9], 'D': [10, 11, 12]})df3 = pd.DataFrame({'E': [13, 14, 15], 'F': [16, 17, 18]})# 方法1:使用ExcelWriterwith pd.ExcelWriter('multi_sheet.xlsx') as writer:    df1.to_excel(writer, sheet_name='Sheet1', index=False)    df2.to_excel(writer, sheet_name='Sheet2', index=False)    df3.to_excel(writer, sheet_name='Sheet3', index=False)# 方法2:使用字典sheets = {'Sheet1': df1,'Sheet2': df2,'Sheet3': df3}with pd.ExcelWriter('multi_sheet.xlsx') as writer:for sheet_name, df in sheets.items():        df.to_excel(writer, sheet_name=sheet_name, index=False)

3.3 格式化写入

import pandas as pdfrom openpyxl.styles import Font, PatternFill, Alignment# 创建数据df = pd.DataFrame({'姓名': ['张三', '李四', '王五'],'年龄': [25, 30, 28],'工资': [8000, 12000, 9500]})# 写入并格式化with pd.ExcelWriter('formatted.xlsx', engine='openpyxl') as writer:    df.to_excel(writer, sheet_name='Sheet1', index=False)# 获取工作表    workbook = writer.book    worksheet = writer.sheets['Sheet1']# 设置列宽    worksheet.column_dimensions['A'].width = 15    worksheet.column_dimensions['B'].width = 12    worksheet.column_dimensions['C'].width = 15# 设置表头样式    header_font = Font(bold=True, color='FFFFFF')    header_fill = PatternFill(start_color='4472C4', fill_type='solid')    header_align = Alignment(horizontal='center', vertical='center')for cell in worksheet[1]:        cell.font = header_font        cell.fill = header_fill        cell.alignment = header_align

四、pandas vs openpyxl对比

4.1 读取性能对比

import pandas as pdimport openpyxlimport timedefpandas_read(filename):"""pandas读取"""    start = time.time()    df = pd.read_excel(filename)print(f"pandas读取: {time.time() - start:.2f}秒")return dfdefopenpyxl_read(filename):"""openpyxl读取"""    start = time.time()    wb = openpyxl.load_workbook(filename)    ws = wb.active    data = []for row in ws.iter_rows(values_only=True):        data.append(list(row))print(f"openpyxl读取: {time.time() - start:.2f}秒")return data# 测试# pandas_read('large_data.xlsx')# openpyxl_read('large_data.xlsx')

4.2 使用场景选择

# 数据分析场景:使用pandasdf = pd.read_excel('data.xlsx')result = df.groupby('部门')['工资'].mean()result.to_excel('result.xlsx')# 复杂格式场景:使用openpyxlfrom openpyxl import load_workbookfrom openpyxl.styles import Font, PatternFillwb = load_workbook('template.xlsx')ws = wb.activews['A1'].font = Font(bold=True, size=14)wb.save('formatted.xlsx')# 混合使用df = pd.read_excel('data.xlsx')with pd.ExcelWriter('output.xlsx', engine='openpyxl') as writer:    df.to_excel(writer, index=False)# 使用openpyxl添加样式    workbook = writer.book    worksheet = writer.sheets['Sheet1']# ... 样式设置 ...

五、实战案例

5.1 数据清洗与导出

import pandas as pdimport numpy as npclassExcelDataCleaner:"""Excel数据清洗"""def__init__(self, input_file):self.df = pd.read_excel(input_file)defclean_data(self):"""清洗数据"""# 删除空行self.df = self.df.dropna(how='all')# 删除空列self.df = self.df.dropna(axis=1, how='all')# 处理重复值self.df = self.df.drop_duplicates()# 去除首尾空格        str_cols = self.df.select_dtypes(include=['object']).columnsfor col in str_cols:self.df[col] = self.df[col].str.strip()# 处理缺失值        numeric_cols = self.df.select_dtypes(include=[np.number]).columnsfor col in numeric_cols:self.df[col] = self.df[col].fillna(self.df[col].mean())# 转换数据类型for col inself.df.columns:ifself.df[col].dtype == 'object':try:self.df[col] = pd.to_numeric(self.df[col])except:passreturnself.dfdefanalyze_data(self):"""数据分析"""        stats = {}# 数值列统计        numeric_cols = self.df.select_dtypes(include=[np.number]).columnsiflen(numeric_cols) > 0:            stats['数值统计'] = self.df[numeric_cols].describe()# 文本列统计        text_cols = self.df.select_dtypes(include=['object']).columnsiflen(text_cols) > 0:            stats['文本统计'] = {}for col in text_cols:                stats['文本统计'][col] = {'唯一值数': self.df[col].nunique(),'最常见值': self.df[col].mode().iloc[0] ifnotself.df[col].mode().empty elseNone,'缺失值数': self.df[col].isnull().sum()                }return statsdefexport_to_excel(self, output_file):"""导出到Excel"""with pd.ExcelWriter(output_file, engine='openpyxl') as writer:# 清洗后的数据self.df.to_excel(writer, sheet_name='清洗数据', index=False)# 统计信息            stats = self.analyze_data()if'数值统计'in stats:                stats['数值统计'].to_excel(writer, sheet_name='数值统计')# 文本统计if'文本统计'in stats:                text_stats_df = pd.DataFrame(stats['文本统计']).T                text_stats_df.to_excel(writer, sheet_name='文本统计')print(f"数据已导出到 {output_file}")# 使用# cleaner = ExcelDataCleaner('raw_data.xlsx')# cleaner.clean_data()# cleaner.export_to_excel('cleaned_data.xlsx')

5.2 Excel报表生成器

import pandas as pdfrom datetime import datetimeclassExcelReportGenerator:"""Excel报表生成器"""def__init__(self):self.data = {}defadd_dataframe(self, name, df):"""添加DataFrame"""self.data[name] = dfdefgenerate_report(self, filename):"""生成报表"""with pd.ExcelWriter(filename, engine='openpyxl') as writer:# 写入每个DataFramefor name, df inself.data.items():                df.to_excel(writer, sheet_name=name, index=False)# 创建汇总表            summary_data = {'报表名称': list(self.data.keys()),'数据行数': [len(df) for df inself.data.values()],'数据列数': [len(df.columns) for df inself.data.values()]            }            summary_df = pd.DataFrame(summary_data)            summary_df.to_excel(writer, sheet_name='汇总', index=False)# 格式化self._format_excel(writer)def_format_excel(self, writer):"""格式化Excel"""from openpyxl.styles import Font, PatternFill, Alignmentfor sheet_name in writer.sheets:            worksheet = writer.sheets[sheet_name]# 设置列宽for column in worksheet.columns:                max_length = 0                column_letter = column[0].column_letterfor cell in column:try:iflen(str(cell.value)) > max_length:                            max_length = len(str(cell.value))except:pass                adjusted_width = min(max_length + 2, 50)                worksheet.column_dimensions[column_letter].width = adjusted_width# 设置表头样式if sheet_name != '汇总':                header_font = Font(bold=True, color='FFFFFF')                header_fill = PatternFill(start_color='4472C4', fill_type='solid')                header_align = Alignment(horizontal='center', vertical='center')for cell in worksheet[1]:                    cell.font = header_font                    cell.fill = header_fill                    cell.alignment = header_align# 使用report = ExcelReportGenerator()# 添加数据df1 = pd.DataFrame({'产品': ['A', 'B', 'C'],'销量': [100, 150, 200]})df2 = pd.DataFrame({'地区': ['北京', '上海', '广州'],'销售额': [1000, 1200, 900]})report.add_dataframe('产品数据', df1)report.add_dataframe('地区数据', df2)report.generate_report('report.xlsx')

5.3 批量处理Excel

import pandas as pdimport globimport osclassExcelBatchProcessor:"""批量Excel处理器"""def__init__(self, input_pattern):self.files = glob.glob(input_pattern)self.results = []defprocess_file(self, filepath):"""处理单个文件"""        df = pd.read_excel(filepath)# 添加文件名列        df['文件名'] = os.path.basename(filepath)# 处理数据        result = {'文件名': os.path.basename(filepath),'行数': len(df),'列数': len(df.columns),'列名': ', '.join(df.columns),'空值数': df.isnull().sum().sum()        }return result, dfdefprocess_all(self):"""处理所有文件"""        all_data = []for filepath inself.files:print(f"处理: {filepath}")            result, df = self.process_file(filepath)self.results.append(result)            all_data.append(df)# 合并所有数据if all_data:self.merged_df = pd.concat(all_data, ignore_index=True)return pd.DataFrame(self.results)defsave_results(self, output_file):"""保存结果"""        summary = self.process_all()with pd.ExcelWriter(output_file, engine='openpyxl') as writer:            summary.to_excel(writer, sheet_name='汇总', index=False)self.merged_df.to_excel(writer, sheet_name='所有数据', index=False)print(f"结果已保存到 {output_file}")# 使用# processor = ExcelBatchProcessor('data/*.xlsx')# processor.save_results('batch_result.xlsx')

六、性能优化

6.1 读取优化

import pandas as pd# 指定引擎df = pd.read_excel('data.xlsx', engine='openpyxl')  # .xlsxdf = pd.read_excel('data.xls', engine='xlrd')       # .xls# 指定数据类型(减少内存)dtype = {'col1': 'int32','col2': 'float32','col3': 'category'}df = pd.read_excel('data.xlsx', dtype=dtype)# 只读取需要的列df = pd.read_excel('data.xlsx', usecols=['col1', 'col2'])# 限制行数df = pd.read_excel('data.xlsx', nrows=1000)

6.2 写入优化

import pandas as pd# 使用xlsxwriter引擎(更快)df.to_excel('output.xlsx', engine='xlsxwriter', index=False)# 分批写入大文件chunk_size = 10000with pd.ExcelWriter('output.xlsx') as writer:for i, chunk inenumerate(pd.read_excel('large.xlsx', chunksize=chunk_size)):        chunk.to_excel(writer, sheet_name=f'Sheet{i+1}', index=False)

七、总结

# 快速参考# 1. 读取Exceldf = pd.read_excel('file.xlsx')df = pd.read_excel('file.xlsx', sheet_name='Sheet1')df = pd.read_excel('file.xlsx', usecols=['A', 'C'])df = pd.read_excel('file.xlsx', skiprows=2, nrows=10)# 2. 写入Exceldf.to_excel('output.xlsx', index=False)df.to_excel('output.xlsx', sheet_name='数据', index=False)# 3. 多工作表with pd.ExcelWriter('output.xlsx') as writer:    df1.to_excel(writer, sheet_name='Sheet1', index=False)    df2.to_excel(writer, sheet_name='Sheet2', index=False)# 4. 数据类型dtype = {'col1': str, 'col2': int}df = pd.read_excel('file.xlsx', dtype=dtype)# 5. 日期解析df = pd.read_excel('file.xlsx', parse_dates=['date_col'])# 6. 缺失值处理df = pd.read_excel('file.xlsx', na_values=['NA', 'NULL'])# 7. 读取所有工作表sheets = pd.read_excel('file.xlsx', sheet_name=None)

pandas提供了高效便捷的Excel读写功能,适合数据分析场景。对于需要复杂格式和样式的场景,可以结合openpyxl使用。根据实际需求选择合适的工具和优化策略,可以提升数据处理的效率和灵活性。

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-11-10 02:08:17 HTTP/1.1 GET : http://h.sjds.net/a/540554.html
  2. 运行时间 : 0.092820s [ 吞吐率:10.77req/s ] 内存消耗:4,424.64kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=a3b063a768b993ea9c664f99cbf5b532
  1. /www/wwwroot/h.sjds.net/public/index.php ( 0.79 KB )
  2. /www/wwwroot/h.sjds.net/vendor/autoload.php ( 0.17 KB )
  3. /www/wwwroot/h.sjds.net/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /www/wwwroot/h.sjds.net/vendor/composer/platform_check.php ( 0.90 KB )
  5. /www/wwwroot/h.sjds.net/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /www/wwwroot/h.sjds.net/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /www/wwwroot/h.sjds.net/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /www/wwwroot/h.sjds.net/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /www/wwwroot/h.sjds.net/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /www/wwwroot/h.sjds.net/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /www/wwwroot/h.sjds.net/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /www/wwwroot/h.sjds.net/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /www/wwwroot/h.sjds.net/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /www/wwwroot/h.sjds.net/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /www/wwwroot/h.sjds.net/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /www/wwwroot/h.sjds.net/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /www/wwwroot/h.sjds.net/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /www/wwwroot/h.sjds.net/app/provider.php ( 0.19 KB )
  23. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /www/wwwroot/h.sjds.net/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /www/wwwroot/h.sjds.net/app/common.php ( 0.03 KB )
  27. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /www/wwwroot/h.sjds.net/config/app.php ( 0.95 KB )
  30. /www/wwwroot/h.sjds.net/config/cache.php ( 0.78 KB )
  31. /www/wwwroot/h.sjds.net/config/console.php ( 0.23 KB )
  32. /www/wwwroot/h.sjds.net/config/cookie.php ( 0.56 KB )
  33. /www/wwwroot/h.sjds.net/config/database.php ( 2.48 KB )
  34. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /www/wwwroot/h.sjds.net/config/filesystem.php ( 0.61 KB )
  36. /www/wwwroot/h.sjds.net/config/lang.php ( 0.91 KB )
  37. /www/wwwroot/h.sjds.net/config/log.php ( 1.35 KB )
  38. /www/wwwroot/h.sjds.net/config/middleware.php ( 0.19 KB )
  39. /www/wwwroot/h.sjds.net/config/route.php ( 1.89 KB )
  40. /www/wwwroot/h.sjds.net/config/session.php ( 0.57 KB )
  41. /www/wwwroot/h.sjds.net/config/trace.php ( 0.34 KB )
  42. /www/wwwroot/h.sjds.net/config/view.php ( 0.82 KB )
  43. /www/wwwroot/h.sjds.net/app/event.php ( 0.25 KB )
  44. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /www/wwwroot/h.sjds.net/app/service.php ( 0.13 KB )
  46. /www/wwwroot/h.sjds.net/app/AppService.php ( 0.26 KB )
  47. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /www/wwwroot/h.sjds.net/vendor/services.php ( 0.14 KB )
  53. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /www/wwwroot/h.sjds.net/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /www/wwwroot/h.sjds.net/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /www/wwwroot/h.sjds.net/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /www/wwwroot/h.sjds.net/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /www/wwwroot/h.sjds.net/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /www/wwwroot/h.sjds.net/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /www/wwwroot/h.sjds.net/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /www/wwwroot/h.sjds.net/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /www/wwwroot/h.sjds.net/app/Request.php ( 0.09 KB )
  84. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /www/wwwroot/h.sjds.net/app/middleware.php ( 0.25 KB )
  86. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /www/wwwroot/h.sjds.net/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /www/wwwroot/h.sjds.net/route/app.php ( 1.72 KB )
  100. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /www/wwwroot/h.sjds.net/app/controller/Index.php ( 4.81 KB )
  104. /www/wwwroot/h.sjds.net/app/BaseController.php ( 2.05 KB )
  105. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /www/wwwroot/h.sjds.net/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /www/wwwroot/h.sjds.net/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /www/wwwroot/h.sjds.net/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /www/wwwroot/h.sjds.net/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /www/wwwroot/h.sjds.net/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /www/wwwroot/h.sjds.net/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /www/wwwroot/h.sjds.net/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /www/wwwroot/h.sjds.net/runtime/temp/c1d6e8c94b2c2fa10e259903674c804d.php ( 8.11 KB )
  140. /www/wwwroot/h.sjds.net/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000783s ] mysql:host=172.18.0.4;port=3306;dbname=h_sjds;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001141s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000481s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000375s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000786s ]
  6. SELECT * FROM `set` [ RunTime:0.000391s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000843s ]
  8. SELECT * FROM `article` WHERE `id` = 540554 LIMIT 1 [ RunTime:0.000741s ]
  9. UPDATE `article` SET `lasttime` = 1794247697 WHERE `id` = 540554 [ RunTime:0.002351s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 65 LIMIT 1 [ RunTime:0.000405s ]
  11. SELECT * FROM `article` WHERE `id` < 540554 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000651s ]
  12. SELECT * FROM `article` WHERE `id` > 540554 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000523s ]
  13. SELECT * FROM `article` WHERE `id` < 540554 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.000970s ]
  14. SELECT * FROM `article` WHERE `id` < 540554 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.000814s ]
  15. SELECT * FROM `article` WHERE `id` < 540554 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.000802s ]
0.105045s