当前位置:首页>python>Python脚本|PDF转Word,精准还原表格与排版

Python脚本|PDF转Word,精准还原表格与排版

  • 2026-06-29 23:00:17
Python脚本|PDF转Word,精准还原表格与排版

在日常办公、学术写作、资料整理时,我们几乎都会遇到PDF 转 Word的需求。但市面上大多数转换工具都有明显短板:表格错乱、格式丢失、字体变形、图片错位,最后还是要花大量时间手动排版。

今天给大家带来一款专业级、高还原度的 Python 转换脚本,专门解决 PDF→Word 的格式丢失问题,表格、文字、段落、图片一键精准复刻,支持批量处理,纯本地运行不伤隐私,小白也能直接用。

一、功能亮点(比普通转换器强太多)

普通在线转换工具要么收费,要么转换后格式全乱。这款脚本完全免费,针对PDF转换场景深度优化,具体效果看下表:

功能特性
说明
自动检测扫描件
智能判断PDF是否扫描版,无需手动区分
OCR文字识别
对扫描件自动添加文字层,中文英文都支持
表格布局保留
使用pdf2docx引擎,精准还原表格和段落位置
批量转换
支持整个文件夹递归处理,一键转换所有PDF
失败重试
自动重试失败的转换,支持记录错误日志
单文件/目录模式
灵活切换,满足不同使用场景

二、零基础小白教程(全新电脑也能操作)

如果你从没装过Python,别慌!跟着下面6步走,全程复制粘贴就能搞定,每个关键步骤都有⚠️提醒。

第1步:安装Python

  1. 打开浏览器,访问Python官网:https://www.python.org/downloads/

  2. 点击黄色的【Download Python】按钮(版本3.8以上都可以)

  3. 双击运行下载的安装程序

  4. ⚠️ 关键步骤:安装界面底部,一定要勾选【Add Python to PATH】,然后点击【Install Now】

  5. 等待安装完成,关闭窗口即可

第2步:安装依赖库

按键盘【Win + R】,输入cmd回车,打开命令提示符窗口,依次粘贴运行以下命令:

pip install pdf2docx pymupdfpip install ocrmypdf

💡 ocrmypdf是可选的,但强烈推荐安装,它会调用Tesseract识别扫描件。安装ocrmypdf前,还需要额外安装两个工具:

  • Tesseract OCR:下载地址 https://github.com/UB-Mannheim/tesseract/wiki

  • Ghostscript:下载地址 https://ghostscript.com/releases/gsdnld.html

下载安装后重启电脑即可。

第3步:保存脚本文件

  1. 在桌面新建一个文本文档(右键→新建→文本文档)

  2. 把脚本完整代码(文末有获取方式)复制粘贴进去

  3. 点击【文件】→【另存为】,文件名改为【pdf_to_word.py

  4. ⚠️ 注意:保存类型选择【所有文件】,确保扩展名是.py(不是.txt

第4步:配置默认文件夹(可选,小白推荐)

用记事本打开刚才保存的【pdf_to_word.py】文件,找到下面这一行:

FIXED_BATCH_DIR = Path(r"D:\pdf\input")

把引号里的路径,改成你存放PDF文件的文件夹路径。例如你的PDF都放在桌面的【我的PDF文件】文件夹,路径就改成:

FIXED_BATCH_DIR = Path(r"C:\Users\你的用户名\Desktop\我的PDF文件")

💡 改完后,后续双击脚本就能直接批量转换,不用每次都输命令!

第5步:运行脚本(5种用法)

🔹 最简单用法(小白首选)

直接把PDF文件放到你配置好的文件夹里,然后双击pdf_to_word.py脚本,它会自动转换该文件夹下所有PDF,并把生成的Word放在同一目录。

🔹 命令行用法(更灵活)

如果你想要更多控制,可以在命令提示符中切换脚本所在目录,然后选择下面的命令:

用法1:转换单个文件

python pdf_to_word.py -i 文档.pdf

用法2:转换单个文件,指定输出位置

python pdf_to_word.py -i 文档.pdf -o D:\转换结果\输出.docx

用法3:批量转换整个文件夹

python pdf_to_word.py -i D:\我的PDF文件

用法4:递归转换(包含子文件夹)

python pdf_to_word.py -i D:\我的PDF文件 --recursive

用法5:强制OCR识别扫描件

python pdf_to_word.py -i 扫描件.pdf --force-ocr --ocr-lang chi_sim+eng

第6步:获取转换结果

脚本运行完成后,Word文档会生成在PDF所在的文件夹(如果没指定输出目录的话)。打开检查,表格和排版都已经完美还原,可以直接编辑使用。

#!/usr/bin/env python3"""PDF to Word converter with better layout/table retention.Features:1) Automatically detect scanned PDFs.2) Run OCR for scanned PDFs (via ocrmypdf) to add a text layer.3) Convert to .docx using pdf2docx to preserve tables/paragraph layout.4) Support single-file and batch directory conversion.Install:    pip install pdf2docx pymupdf    # Optional but recommended for scanned PDFs:    # 1) Install Tesseract OCR on your system.    # 2) Install Ghostscript on your system.    # 3) pip install ocrmypdfExamples:    python pdf_to_word.py    python pdf_to_word.py -i input.pdf -o output.docx    python pdf_to_word.py -i ./pdfs -o ./docx --recursive    python pdf_to_word.py -i scan.pdf --force-ocr --ocr-lang chi_sim+eng    python pdf_to_word.py -i ./pdfs -o ./docx --recursive --retries 2 --error-log ./failed.csv"""from __future__ import annotationsimport argparseimport csvimport shutilimport subprocessimport sysimport tempfileimport timefrom datetime import datetimefrom pathlib import Pathfrom typing import Dict, Iterable, ListOptionalTupleimport fitz  # pymupdffrom pdf2docx import Converter# ====== Fixed batch folder configuration ======# 直接修改该路径后,执行 `python doc/pdf_to_word.py` 即可批量转换。# 输入和输出使用同一个目录:会在该目录(及其子目录)生成同名 .docx。FIXED_BATCH_DIR = Path(r"D:\pdf\input")def find_pdf_files(input_path: Path, recursive: bool) -> List[Path]:    """收集待处理 PDF 文件列表。    - 输入为文件时:仅接受 .pdf    - 输入为目录时:按 recursive 决定是否递归扫描    """    if input_path.is_file():        if input_path.suffix.lower() != ".pdf":            raise ValueError(f"Input file is not a PDF: {input_path}")        return [input_path]    if not input_path.is_dir():        raise ValueError(f"Input path does not exist: {input_path}")    pattern = "**/*.pdf" if recursive else "*.pdf"    return sorted(input_path.glob(pattern))def is_scanned_pdf(pdf_path: Path, sample_pages: int = 3, min_text_chars: int = 60) -> bool:    """    Heuristic:    - If first N pages have very little extractable text, treat as scanned PDF.    """    doc = fitz.open(str(pdf_path))    try:        pages = min(sample_pages, doc.page_count)        if pages <= 0:            return False        total_chars = 0        for i in range(pages):            total_chars += len(doc.load_page(i).get_text("text").strip())        return total_chars < min_text_chars    finally:        doc.close()def require_command(name: str) -> None:    """检查外部命令是否存在于 PATH。"""    if shutil.which(name) is None:        raise RuntimeError(            f"Required command not found: {name}. "            f"Please install it and ensure it is in PATH."        )def run_ocr(input_pdf: Path, output_pdf: Path, ocr_lang: str) -> None:    """调用 ocrmypdf 给扫描件补文本层,便于后续版面/表格识别。"""    require_command("ocrmypdf")    cmd = [        "ocrmypdf",        "--skip-text",        "--redo-ocr",        "-l",        ocr_lang,        str(input_pdf),        str(output_pdf),    ]    print(f"[OCR] {' '.join(cmd)}")    result = subprocess.run(cmd, capture_output=True, text=True)    if result.returncode != 0:        msg = result.stderr.strip() or result.stdout.strip()        raise RuntimeError(f"OCR failed for {input_pdf}:\n{msg}")def convert_pdf_to_docx(input_pdf: Path, output_docx: Path, start: int = 0, end: Optional[int] = None) -> None:    """执行 PDF 到 DOCX 的核心转换。"""    output_docx.parent.mkdir(parents=True, exist_ok=True)    cv = Converter(str(input_pdf))    try:        cv.convert(str(output_docx), start=start, end=end)    finally:        cv.close()def build_output_path(src_pdf: Path, input_root: Path, output_root: Path) -> Path:    """根据输入根目录和输出根目录,构建对应的 .docx 路径。"""    if input_root.is_file():        return output_root    rel = src_pdf.relative_to(input_root)    return output_root / rel.with_suffix(".docx")def convert_one(    pdf_file: Path,    output_docx: Path,    force_ocr: bool,    ocr_lang: str,    start_page: int,    end_page: Optional[int],) -> None:    """转换单个 PDF。    处理流程:    1) 扫描件检测    2) 必要时 OCR    3) 执行 pdf2docx 转换    """    scanned = is_scanned_pdf(pdf_file)    need_ocr = force_ocr or scanned    print(f"\n[INFO] Processing: {pdf_file}")    print(f"[INFO] Scanned detection: {'YES'if scanned else'NO'}")    print(f"[INFO] OCR step: {'ENABLED'if need_ocr else'SKIPPED'}")    with tempfile.TemporaryDirectory(prefix="pdf2docx_"as tmp_dir:        source_pdf = pdf_file        if need_ocr:            ocr_pdf = Path(tmp_dir) / f"{pdf_file.stem}.ocr.pdf"            run_ocr(pdf_file, ocr_pdf, ocr_lang=ocr_lang)            source_pdf = ocr_pdf        convert_pdf_to_docx(            input_pdf=source_pdf,            output_docx=output_docx,            start=max(0, start_page),            end=end_page,        )    print(f"[OK] Output: {output_docx}")def convert_with_retry(    pdf_file: Path,    output_docx: Path,    force_ocr: bool,    ocr_lang: str,    start_page: int,    end_page: Optional[int],    retries: int,    retry_delay: float,) -> Tuple[boolintOptional[str]]:    """带重试机制的单文件转换。    返回:    - 是否成功    - 实际尝试次数    - 错误信息(成功时为 None)    """    # retries 表示“失败后重试次数”,总尝试次数 = retries + 1    max_attempts = max(1, retries + 1)    last_error: Optional[str] = None    for attempt in range(1, max_attempts + 1):        try:            if attempt > 1:                print(f"[RETRY] {pdf_file.name} attempt {attempt}/{max_attempts}")            convert_one(                pdf_file=pdf_file,                output_docx=output_docx,                force_ocr=force_ocr,                ocr_lang=ocr_lang,                start_page=start_page,                end_page=end_page,            )            return True, attempt, None        except Exception as exc:  # noqa: BLE001            last_error = str(exc)            # 失败后按设定间隔重试,减小瞬时环境波动的影响            if attempt < max_attempts and retry_delay > 0:                time.sleep(retry_delay)    return False, max_attempts, last_errordef write_failure_csv(failures: List[Dict[strstr]], error_log_path: Path) -> None:    """将失败任务写入 CSV,便于批量复盘与二次处理。"""    error_log_path.parent.mkdir(parents=True, exist_ok=True)    fieldnames = [        "timestamp",        "input_pdf",        "output_docx",        "attempts",        "error",    ]    with error_log_path.open("w", newline="", encoding="utf-8-sig"as f:        writer = csv.DictWriter(f, fieldnames=fieldnames)        writer.writeheader()        writer.writerows(failures)def parse_args(argv: Optional[Iterable[str]] = None) -> argparse.Namespace:    """解析命令行参数。"""    parser = argparse.ArgumentParser(        description="Convert PDF to Word with OCR support for scanned PDFs."    )    parser.add_argument(        "-i",        "--input",        required=False,        default=None,        help=(            "Input PDF file or directory. "            "If omitted, the script uses FIXED_BATCH_DIR."        ),    )    parser.add_argument(        "-o",        "--output",        required=False,        help=(            "Output .docx file (single input) or output directory (batch input). "            "Default: same folder as input."        ),    )    parser.add_argument(        "--recursive",        action="store_true",        help="Recursively scan input directory for PDFs.",    )    parser.add_argument(        "--force-ocr",        action="store_true",        help="Force OCR even if PDF already has extractable text.",    )    parser.add_argument(        "--ocr-lang",        default="chi_sim+eng",        help="OCR language for ocrmypdf (default: chi_sim+eng).",    )    parser.add_argument(        "--start-page",        type=int,        default=0,        help="Start page index for conversion (0-based, default: 0).",    )    parser.add_argument(        "--end-page",        type=int,        default=None,        help="End page index for conversion (0-based, exclusive).",    )    parser.add_argument(        "--retries",        type=int,        default=2,        help="Retry count after a failure (default: 2).",    )    parser.add_argument(        "--retry-delay",        type=float,        default=1.0,        help="Delay seconds between retries (default: 1.0).",    )    parser.add_argument(        "--error-log",        default=None,        help=(            "CSV path for failed tasks. "            "Default: single file -> same dir 'pdf_to_word_failures.csv'; "            "batch -> output dir 'pdf_to_word_failures.csv'."        ),    )    return parser.parse_args(argv)def main(argv: Optional[Iterable[str]] = None) -> int:    """程序入口:支持单文件模式与批量目录模式。"""    args = parse_args(argv)    use_fixed_folder_mode = args.input is None    input_path = (        FIXED_BATCH_DIR.expanduser().resolve()        if use_fixed_folder_mode        else Path(args.input).expanduser().resolve()    )    try:        pdf_files = find_pdf_files(input_path, recursive=args.recursive)    except ValueError as exc:        print(f"[ERROR] {exc}")        return 2    if not pdf_files:        print(f"[WARN] No PDF files found in: {input_path}")        return 0    if input_path.is_file():        # 单文件模式:输出必须是 .docx(或默认同名)        if args.output:            out_path = Path(args.output).expanduser().resolve()            if out_path.suffix.lower() != ".docx":                print("[ERROR] For single input file, output must end with .docx")                return 2            output_path = out_path        else:            output_path = input_path.with_suffix(".docx")        ok, attempts, err = convert_with_retry(            pdf_file=pdf_files[0],            output_docx=output_path,            force_ocr=args.force_ocr,            ocr_lang=args.ocr_lang,            start_page=args.start_page,            end_page=args.end_page,            retries=args.retries,            retry_delay=args.retry_delay,        )        if ok:            return 0        # 单文件失败也写 CSV,统一日志格式        error_log_path = (            Path(args.error_log).expanduser().resolve()            if args.error_log            else output_path.parent / "pdf_to_word_failures.csv"        )        failures = [            {                "timestamp": datetime.now().isoformat(timespec="seconds"),                "input_pdf"str(pdf_files[0]),                "output_docx"str(output_path),                "attempts"str(attempts),                "error": err or "Unknown error",            }        ]        write_failure_csv(failures, error_log_path)        print(f"[ERROR] {pdf_files[0]}{err}")        print(f"[LOG] Failure CSV: {error_log_path}")        return 1    output_root = (        Path(args.output).expanduser().resolve()        if args.output        else input_path    )    output_root.mkdir(parents=True, exist_ok=True)    # 批量模式:记录失败任务,最后统一落盘 CSV    failed = 0    failure_records: List[Dict[strstr]] = []    for pdf_file in pdf_files:        output_docx = build_output_path(            src_pdf=pdf_file,            input_root=input_path,            output_root=output_root,        )        ok, attempts, err = convert_with_retry(            pdf_file=pdf_file,            output_docx=output_docx,            force_ocr=args.force_ocr,            ocr_lang=args.ocr_lang,            start_page=args.start_page,            end_page=args.end_page,            retries=args.retries,            retry_delay=args.retry_delay,        )        if not ok:            failed += 1            print(f"[ERROR] {pdf_file}{err}")            failure_records.append(                {                    "timestamp": datetime.now().isoformat(timespec="seconds"),                    "input_pdf"str(pdf_file),                    "output_docx"str(output_docx),                    "attempts"str(attempts),                    "error": err or "Unknown error",                }            )    total = len(pdf_files)    success = total - failed    print(f"\n[DONE] Total: {total}, Success: {success}, Failed: {failed}")    if failure_records:        # 优先使用用户指定路径,否则默认写到输出目录        error_log_path = (            Path(args.error_log).expanduser().resolve()            if args.error_log            else output_root / "pdf_to_word_failures.csv"        )        write_failure_csv(failure_records, error_log_path)        print(f"[LOG] Failure CSV: {error_log_path}")    return 1 if failed else 0if __name__ == "__main__":    sys.exit(main())

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-03 19:19:51 HTTP/2.0 GET : https://f.mffb.com.cn/a/489820.html
  2. 运行时间 : 0.263715s [ 吞吐率:3.79req/s ] 内存消耗:4,600.45kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=88eb6427df1fc17c77eb896c8a9c2289
  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.001077s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001594s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.006997s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.001088s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001625s ]
  6. SELECT * FROM `set` [ RunTime:0.000801s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001675s ]
  8. SELECT * FROM `article` WHERE `id` = 489820 LIMIT 1 [ RunTime:0.024438s ]
  9. UPDATE `article` SET `lasttime` = 1783077592 WHERE `id` = 489820 [ RunTime:0.018783s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.006398s ]
  11. SELECT * FROM `article` WHERE `id` < 489820 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.001308s ]
  12. SELECT * FROM `article` WHERE `id` > 489820 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.001751s ]
  13. SELECT * FROM `article` WHERE `id` < 489820 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.005363s ]
  14. SELECT * FROM `article` WHERE `id` < 489820 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.005732s ]
  15. SELECT * FROM `article` WHERE `id` < 489820 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.003056s ]
0.267500s