当前位置:首页>python>从聊天到行动:用LangChain Python打造自主决策的AI Agent

从聊天到行动:用LangChain Python打造自主决策的AI Agent

  • 2026-06-28 12:31:40
从聊天到行动:用LangChain Python打造自主决策的AI Agent

什么问题

 大多数开发者用LangChain时,只停留在“一问一答”的聊天模式。但真实生产环境需要的AI,是能自主分析问题、调用外部工具、决定何时检索知识库的智能体(Agent)。原文介绍的LangChain.js课程揭示了这一转变,而Python生态同样有强大的LangChain库,且语法更简洁、生态更丰富。本文面向Python工程师,用三个可运行示例,带你从基础调用一路走到Agentic RAG(智能体增强检索),理解“为什么这样做”而非“先做A再做B”。 

核心原理

 传统LLM调用就像一个人,你问什么他直接回答什么,既不会主动查资料,也不会调用计算器。Agent则像一位“有工具的员工”:他接到任务后会先思考(ReAct循环),决定是否需要使用某个工具(如搜索、计算器),执行工具后根据结果继续推理,直到给出最终答案。 

 Agentic RAG更进一步:Agent会判断“这个问题我能不能直接回答?”,只有遇到不确定或需要最新数据时才去检索知识库。这比“每次对话都搜一遍”的朴素RAG更高效、更省钱,也更像人类“开卷考试”中先凭记忆答简单题,再翻书查难题。 

Python 实现 - 代码示例

示例 1:基础实现——首次LLM调用与结构化输出

场景描述:很多初学者第一步就是让模型写一首诗,但很快发现输出格式不可控。本示例展示如何用Pydantic定义输出结构,让模型按指定格式返回(如JSON),这是后续工具调用和Agent的基础。 

PYTHON IT职场小袁同学 · PYTHON.md

1import os2from langchain_openai import ChatOpenAI3from langchain_core.pydantic_v1 import BaseModel, Field4from langchain_core.messages import HumanMessage5from typing import List67# 定义输出结构:一首诗8class Poem(BaseModel):9    title: str = Field(description="诗的标题")10    lines: List[str] = Field(description="诗的内容,每行一个元素")11    sentiment: str = Field(description="整体情感基调")1213# 初始化模型(确保环境变量OPENAI_API_KEY已设置)14llm = ChatOpenAI(model="gpt-4o-mini", temperature=0.7)1516# 用with_structured_output绑定结构,模型会自动输出JSON17structured_llm = llm.with_structured_output(Poem)1819# 发送请求20result = structured_llm.invoke([21    HumanMessage(content="写一首关于秋天的五言绝句")22])2324print(f"标题:{result.title}")25print("内容:")26for line in result.lines:27    print(f"  {line}")28print(f"情感:{result.sentiment}")29

运行结果: 

PYTHON IT职场小袁同学 · PYTHON.md

1标题:秋思2内容:3  秋风起兮白云飞4  草木黄落兮雁南归5  兰有秀兮菊有芳6  怀佳人兮不能忘7情感:寂寥而怀旧8

代码说明: 

  • 第一段:导入所需库,ChatOpenAI是官方推荐的OpenAI模型封装,pydantic_v1用于定义数据模式。
  • 第二段:用BaseModel定义输出格式,Field添加说明帮助模型理解。
  • 第三段:创建模型实例,temperature控制创造性。
  • 第四段:关键一步——with_structured_output将模型输出自动解析为Pydantic对象,不再需要手动解析JSON。
  • 第五段:调用invoke,传入消息列表(可包含系统消息)。模型返回的是Poem实例,可直接访问属性。
  • 最后打印结果。注意:实际输出内容因模型和温度而异,但格式一定是结构化的。

示例 2:实际应用——函数调用让AI“动手做”

场景描述:上一示例只是“说话”,现在要让AI能调用你的函数。比如做一个天气查询助手:用户问“北京今天需要带伞吗?”,Agent应调用天气工具获取数据,再回答。 

PYTHON IT职场小袁同学 · PYTHON.md

1import os2from langchain_openai import ChatOpenAI3from langchain_core.tools import tool4from langchain.agents import create_tool_calling_agent, AgentExecutor5from langchain_core.prompts import ChatPromptTemplate67# 1. 定义一个模拟的天气查询工具(真实场景可调用API)8@tool9def get_weather(city: str, date: str) -> str:10    """根据城市和日期返回天气概况"""11    # 模拟数据12    weather_data = {13        ("北京", "2025-03-20"): "多云,气温10-18°C,无需带伞",14        ("上海", "2025-03-20"): "小雨,气温15-20°C,建议带伞",15    }16    return weather_data.get((city, date), "暂无数据")1718# 2. 创建LLM和工具列表19llm = ChatOpenAI(model="gpt-4o-mini", temperature=0)20tools = [get_weather]2122# 3. 创建提示模板,告诉Agent如何使用工具23prompt = ChatPromptTemplate.from_messages([24    ("system", "你是一个天气助手。当用户询问天气时,使用get_weather工具获取数据。"),25    ("human", "{input}"),26    ("placeholder", "{agent_scratchpad}"),27])2829# 4. 构建Agent和Executor30agent = create_tool_calling_agent(llm, tools, prompt)31agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)3233# 5. 执行对话34response = agent_executor.invoke({"input": "北京今天(2025年3月20日)需要带伞吗?"})35print(f"\n最终回答:{response['output']}")36

运行结果: 

PYTHON IT职场小袁同学 · PYTHON.md

1Entering new AgentExecutor chain...2Invoking: `get_weather` with `{'city': '北京', 'date': '2025-03-20'}`34多云,气温10-18°C,无需带伞5Finished chain.67最终回答:北京今天多云,气温10-18°C,无需带伞。8

代码说明

  • @tool
    装饰器将普通函数变成LangChain工具,函数名、参数、文档字符串都会被模型理解。
  • create_tool_calling_agent
    是LangChain新式Agent构建方式(推荐),它会自动处理ReAct循环。
  • AgentExecutor
    负责运行Agent,verbose=True可看到内部思考过程(如上所示)。
  • 模型收到问题后,自动判断需要调用get_weather,传入参数,获得结果后生成自然语言回答。
  • 注意:agent_scratchpad占位符用于保存中间思考步骤,LangChain会自动填充。

示例 3:最佳实践——Agentic RAG:智能体自主决定是否检索

场景描述:朴素RAG每次对话都检索知识库,浪费算力。Agentic RAG让Agent先判断:这个问题我能直接回答吗?如果不能,再触发检索。本示例模拟一个公司政策问答系统,Agent拥有“检索知识库”工具,但只有遇到不确定的问题时才使用。 

PYTHON IT职场小袁同学 · PYTHON.md

1import os2from langchain_openai import ChatOpenAI, OpenAIEmbeddings3from langchain_community.vectorstores import FAISS4from langchain_core.tools import tool5from langchain.agents import create_tool_calling_agent, AgentExecutor6from langchain_core.prompts import ChatPromptTemplate7from langchain_core.documents import Document89# 1. 准备少量知识库文档(模拟公司政策)10docs = [11    Document(page_content="年假政策:员工每年有15天带薪年假,需提前一周申请。"),12    Document(page_content="加班补贴:工作日加班按1.5倍工资计算,周末加班2倍。"),13    Document(page_content="试用期:新员工试用期3个月,期间薪资为正式工资的80%。"),14]1516# 2. 创建向量存储(用于检索)17embeddings = OpenAIEmbeddings(model="text-embedding-3-small")18vectorstore = FAISS.from_documents(docs, embeddings)19retriever = vectorstore.as_retriever(search_kwargs={"k": 1})2021# 3. 定义一个检索工具,由Agent决定是否调用22@tool23def search_policy(query: str) -> str:24    """从公司政策知识库中检索相关信息"""25    results = retriever.invoke(query)26    if results:27        return results[0].page_content28    return "未找到相关信息"2930# 4. 创建Agent,但要求它优先用自己的知识回答31prompt = ChatPromptTemplate.from_messages([32    ("system", 33     "你是一位精通公司政策的HR助手。请先尝试用自己的知识回答用户问题。"34     "只有当你完全不确定时,才调用search_policy工具查询知识库。"),35    ("human", "{input}"),36    ("placeholder", "{agent_scratchpad}"),37])3839llm = ChatOpenAI(model="gpt-4o-mini", temperature=0)40tools = [search_policy]41agent = create_tool_calling_agent(llm, tools, prompt)42agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)4344# 5. 测试两个问题:一个常识(Agent自己回答),一个需要检索45print("问题1:今天是2025年3月20日,星期几?")46resp1 = agent_executor.invoke({"input": "今天是2025年3月20日,星期几?"})47print(f"回答:{resp1['output']}\n")4849print("问题2:新员工试用期薪资是多少?")50resp2 = agent_executor.invoke({"input": "新员工试用期薪资是多少?"})51print(f"回答:{resp2['output']}\n")5253print("问题3:我出差报销额度是多少?(知识库未包含)")54resp3 = agent_executor.invoke({"input": "我出差报销额度是多少?"})55print(f"回答:{resp3['output']}")56

运行结果: 

PYTHON IT职场小袁同学 · PYTHON.md

1问题1:今天是2025年3月20日,星期几?2Entering new AgentExecutor chain...3(没有调用工具,直接回答)4Finished chain.5回答:今天是2025年3月20日,星期四。67问题2:新员工试用期薪资是多少?8Entering new AgentExecutor chain...9Invoking: `search_policy` with `{'query': '新员工试用期薪资'}`10试用期:新员工试用期3个月,期间薪资为正式工资的80%。11Finished chain.12回答:新员工试用期薪资为正式工资的80%。1314问题3:我出差报销额度是多少?15Entering new AgentExecutor chain...16Invoking: `search_policy` with `{'query': '出差报销额度'}`17未找到相关信息18Finished chain.19回答:抱歉,我目前的知识库中没有关于出差报销额度的信息。建议您查阅公司最新的差旅政策文件或联系财务部门。20

代码说明: 

  • 先创建小型FAISS向量库,包含三条政策文档。OpenAIEmbeddings将文本转为向量。
  • search_policy
    工具封装了检索逻辑,Agent调用时传入查询词。
  • 关键在系统提示:明确告诉Agent“先用自己的知识,不确定再检索”。这实现了Agentic RAG的核心——自主判断。
  • 问题1(星期几)是常识,Agent直接回答,未调用工具,节省了检索成本。
  • 问题2(试用期薪资)涉及知识库,Agent调用工具获取准确数据。
  • 问题3(出差报销)知识库没有,Agent诚实告知未找到,并给出建议。这正是Agentic RAG优于朴素RAG的地方——不会硬编造答案。

与其他语言的对比

维度
Python (LangChain)
JavaScript (LangChain.js)
Java (LangChain4j)
语法简洁度
高,装饰器、列表推导、Pydantic 集成自然
中等,TypeScript 类型系统强大但模板较多
较低,需要大量接口和配置类
生态丰富度
极广,NLP、数据处理、科学计算库无缝调用
前端和后端一体化,适合全栈
企业级,但 AI 工具数量有限
Agent 构建方式create_tool_calling_agent
 一行搞定
类似,但需手动处理中间步骤输出
需要更多样板代码
学习曲线
低,Python 社区 AI 教程最多
中等,需同时掌握 Node 和 TS
高,适合 Java 生态团队
生产部署
可对接 FastAPI、Celery 等成熟框架
适合 Serverless、Edge 场景
适合 Spring Boot 微服务

 对于Python工程师,LangChain Python库是首选:代码更短、调试更直观、第三方工具(如FAISS、Chroma、LanceDB)安装简单。如果你已经熟悉Python的数据科学生态,迁移到Agent开发几乎没有额外成本。 

总结与建议

 1. 先打好基础:从结构化输出开始(示例1),控制模型行为比单纯聊天更重要。 

2. 工具是Agent的灵魂:用@tool装饰器把任何Python函数变成AI可调用的能力(示例2),这是从“对话”跨越到“行动”的关键。 

3. Agentic RAG是未来方向:不要无脑检索,让Agent自己判断何时需要知识库(示例3)。这能降低延迟、减少API调用费用,并提升回答可靠性。 

附录:环境配置与快速运行

 如果你想在本地运行以上示例,只需三步: 

 1. 安装依赖(Python 3.10+) 

BASH IT职场小袁同学 · PYTHON.md

1pip install langchain langchain-openai langchain-community faiss-cpu pydantic

 2. 设置环境变量 创建 .env 文件(与原文JS课程类似,但Python环境变量名更直接): 

INI IT职场小袁同学 · PYTHON.md

1OPENAI_API_KEY=sk-xxxx...2OPENAI_ENDPOINT=https://api.openai.com/v1  # 可选,兼容Azure或GitHub Models3OPENAI_MODEL=gpt-4o-mini4OPENAI_EMBEDDING_MODEL=text-embedding-3-small

 然后运行前加载:from dotenv import load_dotenv; load_dotenv()

 3. 运行示例 直接 python example1.py 即可看到输出。所有代码均采用 invoke 同步调用,方便调试。生产环境可改用 ainvoke 异步版本。 

扩展阅读:从JS课程到Python的思维迁移

 原文LangChain.js课程强调“先学工具和Agent,再学检索”,Python版同样适用。但Python社区有两点优势: 

  • Pydantic vs Zod
    :Pydantic的 BaseModel 与 Field 比Zod更简洁,且原生支持嵌套和验证。
  • FAISS与Chroma
    :Python端拥有最成熟的向量数据库绑定,安装只需一行 pip,而JS端需额外处理C++编译。

 如果你已熟悉原文的JS示例,迁移到Python只需记住:@tool 装饰器等价于 JS 的 tool() 函数;create_tool_calling_agent 等价于 createToolCallingAgentAgentExecutor 用法完全一致。 

下一步建议

 1. 尝试MCP(Model Context Protocol):Python有 mcp 库,可搭建MCP服务器,让Agent像调用本地工具一样调用外部API(如数据库、Slack)。 

2. 加入记忆:用 langchain.memory 实现对话历史,让Agent记住上下文。 

3. 部署为API:结合FastAPI,将AgentExecutor包装成REST端点,供前端调用。 

 现在,打开终端,参考其思路,但用Python重写你的第一个Agent吧! 

📊 AI小袁点评:用三个递进示例,让AI从“会说话”升级为“会行动”,是LangChain入门的优质指南。 

推荐指数:5星(理由:将抽象概念转化为可运行示例,直击开发痛点,实用性强,值得反复练习)

声明:本文内容由AI小袁智能工作流自动生成,仅供参考学习。文中观点不代表本平台立场,如有侵权请联系删除。 

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-03 02:19:23 HTTP/2.0 GET : https://f.mffb.com.cn/a/498670.html
  2. 运行时间 : 0.466831s [ 吞吐率:2.14req/s ] 内存消耗:4,537.41kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=bd7bd23008e8ce7a6361df8a6ffd0d81
  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.000994s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001381s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.004035s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.014139s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001439s ]
  6. SELECT * FROM `set` [ RunTime:0.000644s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001489s ]
  8. SELECT * FROM `article` WHERE `id` = 498670 LIMIT 1 [ RunTime:0.005508s ]
  9. UPDATE `article` SET `lasttime` = 1783016363 WHERE `id` = 498670 [ RunTime:0.031804s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.002300s ]
  11. SELECT * FROM `article` WHERE `id` < 498670 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.017488s ]
  12. SELECT * FROM `article` WHERE `id` > 498670 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000549s ]
  13. SELECT * FROM `article` WHERE `id` < 498670 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.007479s ]
  14. SELECT * FROM `article` WHERE `id` < 498670 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.132860s ]
  15. SELECT * FROM `article` WHERE `id` < 498670 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.048005s ]
0.468297s