当前位置:首页>Excel>Excel处理——pandas读写Excel

Excel处理——pandas读写Excel

  • 2026-07-21 22:43:18
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=[012])  # 列索引# 指定行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=[12])  # 列索引# 自定义日期解析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 = {'姓名': ['张三''李四''王五'],'年龄': [253028],'城市': ['北京''上海''广州']}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': [123], 'B': [456]})df2 = pd.DataFrame({'C': [789], 'D': [101112]})df3 = pd.DataFrame({'E': [131415], 'F': [161718]})# 方法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({'姓名': ['张三''李四''王五'],'年龄': [253028],'工资': [8000120009500]})# 写入并格式化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[0ifnotself.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 + 250)                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'],'销量': [100150200]})df2 = pd.DataFrame({'地区': ['北京''上海''广州'],'销售额': [10001200900]})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-07-23 10:19:40 HTTP/2.0 GET : https://h.sjds.net/a/540554.html
  2. 运行时间 : 0.202442s [ 吞吐率:4.94req/s ] 内存消耗:4,438.91kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=6a4f8af2d2e7112fa60924dd3503b766
  1. /yingpanguazai/ssd/ssd1/www/h.sjds.net/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/h.sjds.net/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/h.sjds.net/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/h.sjds.net/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/h.sjds.net/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/h.sjds.net/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/h.sjds.net/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/h.sjds.net/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/h.sjds.net/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/h.sjds.net/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/h.sjds.net/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/h.sjds.net/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/h.sjds.net/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/h.sjds.net/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/h.sjds.net/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/h.sjds.net/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/h.sjds.net/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/h.sjds.net/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/h.sjds.net/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/h.sjds.net/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/h.sjds.net/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/h.sjds.net/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/h.sjds.net/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/h.sjds.net/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/h.sjds.net/runtime/temp/ad153693ed39fba6d1bda2fe72512cde.php ( 12.06 KB )
  140. /yingpanguazai/ssd/ssd1/www/h.sjds.net/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000999s ] mysql:host=127.0.0.1;port=3306;dbname=h_sjds;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001387s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000661s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000653s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001123s ]
  6. SELECT * FROM `set` [ RunTime:0.000478s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001722s ]
  8. SELECT * FROM `article` WHERE `id` = 540554 LIMIT 1 [ RunTime:0.001426s ]
  9. UPDATE `article` SET `lasttime` = 1784773180 WHERE `id` = 540554 [ RunTime:0.015424s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 65 LIMIT 1 [ RunTime:0.000388s ]
  11. SELECT * FROM `article` WHERE `id` < 540554 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.001397s ]
  12. SELECT * FROM `article` WHERE `id` > 540554 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.024340s ]
  13. SELECT * FROM `article` WHERE `id` < 540554 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.000921s ]
  14. SELECT * FROM `article` WHERE `id` < 540554 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.000909s ]
  15. SELECT * FROM `article` WHERE `id` < 540554 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.000648s ]
0.204061s