当前位置:首页>python>用 Python 从零手写你的第一个 AI Agent!手把手带你开发一个智能旅行助手(附完整源码)

用 Python 从零手写你的第一个 AI Agent!手把手带你开发一个智能旅行助手(附完整源码)

  • 2026-01-12 13:36:35
用 Python 从零手写你的第一个 AI Agent!手把手带你开发一个智能旅行助手(附完整源码)
      大语言模型(LLM)很强,但它无法感知当下的时间,也不知道今天的天气。本文将带你通过几十行 Python 代码,基于 ReAct 范式,打造一个能够自主思考、调用工具、联网搜索的 AI Agent。

一. 为什么我们需要 Agent?

大家都用过 ChatGPT 或类似的大模型。它们博古通今,能写诗、写代码。但是,当你问它:“现在郑州的天气怎么样?”或者“帮我查查今天去哪里玩最合适?”时,它往往会告诉你:“作为一个人工智能,我无法访问实时互联网……”

这是因为 LLM 只是一个“大脑”,它被困在了训练数据的盒子里。

要打破这个盒子,我们需要给它装上“手”和“眼睛”,这就是 AI Agent (智能体) 的概念。

简单来说:

Agent = LLM(大脑)+ Memory(记忆)+ Planning(规划)+ Tools(工具)

今天,我们不依赖复杂的框架,直接用 Python 原生代码实现一个基于 ReAct (Reasoning + Acting) 模式的智能旅行助手。

二. 核心原理:ReAct 模式

我们如何让模型学会使用工具?答案是 ReAct,即 Reasoning(推理)+ Acting(行动)。

我们在 System Prompt(系统提示词)中规定一种特殊的“思考协议”,强制模型按照以下步骤循环:

  1. Thought: 我现在需要做什么?

  2. Action: 调用什么工具?参数是什么?

  3. Observation: 工具返回的结果是什么?

  4. Repeat: 重复以上步骤,直到得出最终答案。

三. 代码实战:构建你的旅行助手

我们将使用 Python + OpenAI 接口 + Tavily (搜索工具) + Wttr.in (天气工具) 来实现。

第一步:给 AI 装备“工具箱”

首先,我们需要定义 AI 可以使用的函数。这里我们准备了三个工具:

  1. get_weather: 获取实时天气。

  2. get_forecast: 获取未来天气预报。

  3. get_attraction: 根据天气搜索景点。

代码片段:

def get_weather(city: str) -> str:    # 调用 wttr.in 接口获取实时数据    url = f"https://wttr.in/{city}?format=j1"    # ... (省略网络请求代码,详见文末完整源码)    return f"{city}当前天气:{desc},气温{temp}摄氏度"def get_attraction(city: str, weather: str) -> str:    # 调用 Tavily Search API 联网搜索    query = f"'{city}' 在'{weather}'天气下最值得去的旅游景点推荐及理由"    # ...    return response["answer"]

第二步:编写“大脑”的指令说明书

这是最关键的一步。我们需要在 System Prompt 中告诉 LLM:“你不仅仅是聊天机器人,你是一个能够调用工具的 Agent。”

代码片段:

AGENT_SYSTEM_PROMPT = """你是一个智能旅行助手。# 可用工具:- get_weather(city: str)- get_attraction(city: str, weather: str)...# 行动格式:Thought: [思考过程]Action: [函数调用,如 get_weather(city="Beijing")]"""
注意:我们并没有使用 OpenAI 的 Function Calling API,而是通过 Prompt Engineering让模型直接输出文本格式的 Action,这种方法通用性极强,适用于任何 LLM。

第三步:构建思考循环 (The Loop)

Agent 不是一次性运行的,它需要一个 While 或 For 循环。模型输出 Action -> 我们执行 Action -> 将结果喂回给模型 -> 模型继续思考。

核心逻辑解析:

# 伪代码逻辑history = ["用户请求: 帮我查郑州天气并推荐景点"]while True:    # 1. 让 LLM 思考    response = llm.generate(history)    # 2. 解析 LLM 想要调用的工具    if "Action:" in response:        tool_name, args = parse(response)        # 3. 执行工具 (Python 真正执行函数的地方)        result = tools[tool_name](**args)        # 4. 将结果作为 Observation 存入历史        history.append(f"Observation: {result}")    # 5. 如果 LLM 决定结束    if "finish" in response:        print("最终答案:", final_answer)        break
在这个循环中,Python 代码充当了 LLM 的“四肢”,负责执行具体的网络请求,并将结果反馈给大脑。

四. 运行效果

经过三轮的ReAct, 最终完成用户的旅途规划。

五. 总结与展望

通过这几十行代码,我们通过字符串匹配循环提示,手动实现了一个 Agent 的雏形。这就是当下最火的 AI Agent 的底座逻辑。

当然,生产环境的 Agent 还需要考虑:

  • 记忆管理:对话太长了怎么压缩?

  • 容错机制:工具调用失败了怎么办?

  • 多步规划:如何解决更复杂的“订机票+订酒店+发邮件”任务?

完整可运行的 Python 源码

import requestsimport jsonimport osimport sysfrom tavily import TavilyClientfrom openai import OpenAIimport reimport configAGENT_SYSTEM_PROMPT = """你是一个智能旅行助手。你的任务是分析用户的请求,并使用可用工具一步步地解决问题。根据用户的输入,确定需要调用哪些工具来获取信息,并帮助用户规划旅行过程。# 可用工具:- `get_attraction(city: str, weather: str)`: 根据城市和天气搜索推荐的旅游景点。- `get_forecast(city: str, days: int)`: 查询指定城市未来若干天的天气预报。- `get_weather(city: str)`: 查询指定城市的实时天气。# 行动格式:你的回答必须严格遵循以下格式。首先是你的思考过程,然后是你要执行的具体行动,每次回复只输出一对Thought-Action:Thought: [这里是你的思考过程和下一步计划]Action: [这里是你要调用的工具,格式为 function_name(arg_name="arg_value")]# 任务完成:当你收集到足够的信息,能够回答用户的最终问题时,你必须在`Action:`字段后使用 `finish(answer="...")` 来输出最终答案。请开始吧!"""def get_weather(city: str) -> str:    """    通过调用 wttr.in API 查询真实的天气信息。    """    # API端点,我们请求JSON格式的数据    url = f"https://wttr.in/{city}?format=j1"    try:        # 发起网络请求        response = requests.get(url)        # 检查响应状态码是否为200 (成功)        response.raise_for_status()         # 解析返回的JSON数据        data = response.json()        # 提取当前天气状况        current_condition = data['current_condition'][0]        weather_desc = current_condition['weatherDesc'][0]['value']        temp_c = current_condition['temp_C']        # 格式化成自然语言返回        return f"{city}当前天气:{weather_desc},气温{temp_c}摄氏度"    except requests.exceptions.RequestException as e:        # 处理网络错误        return f"错误:查询天气时遇到网络问题 - {e}"    except (KeyError, IndexError) as e:        # 处理数据解析错误        return f"错误:解析天气数据失败,可能是城市名称无效 - {e}"def get_forecast(city: str, days: str = "3") -> str:    """    查询未来几天的天气。`days`可以是字符串或整数,默认为3天,最大支持7天。    """    try:        days_int = int(days)    except Exception:        return "错误:参数 days 必须为整数。"    if days_int < 1:        return "错误:days 必须至少为1。"    if days_int > 7:        days_int = 7    url = f"https://wttr.in/{city}?format=j1"    try:        response = requests.get(url)        response.raise_for_status()        data = response.json()        weather_list = data.get("weather", [])        if not weather_list:            return "错误:未能获取到天气预报信息。"        days_available = min(days_int, len(weather_list))        parts = [f"{city} 接下来 {days_available} 天的天气预报:"]        for i in range(days_available):            day = weather_list[i]            date = day.get("date""未知日期")            maxtemp = day.get("maxtempC""?")            mintemp = day.get("mintempC""?")            desc = ""            # 有时 hourly 中会包含 weatherDesc            try:                hourly = day.get("hourly", [])                if hourly:                    desc = hourly[0].get("weatherDesc", [{"value"""}])[0].get("value""")            except Exception:                desc = ""            parts.append(f"- {date}{desc},最高{maxtemp}°C,最低{mintemp}°C")        return "\n".join(parts)    except requests.exceptions.RequestException as e:        return f"错误:查询天气预报时遇到网络问题 - {e}"    except Exception as e:        return f"错误:解析天气预报数据时出错 - {e}"def get_attraction(city: str, weather: str) -> str:    """    根据城市和天气,使用Tavily Search API搜索并返回优化后的景点推荐。    """    # 1. 从环境变量中读取API密钥    api_key = config.TAVILY_API_KEY    if not api_key:        return "错误:未配置TAVILY_API_KEY环境变量。"    # 2. 初始化Tavily客户端    tavily = TavilyClient(api_key=api_key)    # 3. 构造一个精确的查询    query = f"'{city}' 在'{weather}'天气下最值得去的旅游景点推荐及理由"    try:        # 4. 调用API,include_answer=True会返回一个综合性的回答        response = tavily.search(query=query, search_depth="basic", include_answer=True)        # 5. Tavily返回的结果已经非常干净,可以直接使用        # response['answer'] 是一个基于所有搜索结果的总结性回答        if response.get("answer"):            return response["answer"]        # 如果没有综合性回答,则格式化原始结果        formatted_results = []        for result in response.get("results", []):            formatted_results.append(f"- {result['title']}{result['content']}")        if not formatted_results:             return "抱歉,没有找到相关的旅游景点推荐。"        return "根据搜索,为您找到以下信息:\n" + "\n".join(formatted_results)    except Exception as e:        return f"错误:执行Tavily搜索时出现问题 - {e}"# 将所有工具函数放入一个字典,方便后续调用available_tools = {    "get_weather": get_weather,    "get_forecast": get_forecast,    "get_attraction": get_attraction,}class OpenAICompatibleClient:    """    一个用于调用任何兼容OpenAI接口的LLM服务的客户端。    """    def __init__(self, model: str, api_key: str, base_url: str):        self.model = model        self.client = OpenAI(api_key=api_key, base_url=base_url)    def generate(self, prompt: str, system_prompt: str) -> str:        """调用LLM API来生成回应。"""        print("正在调用大语言模型...")        try:            messages = [                {'role''system''content': system_prompt},                {'role''user''content': prompt}            ]            response = self.client.chat.completions.create(                model=self.model,                messages=messages,                stream=False            )            answer = response.choices[0].message.content            print("大语言模型响应成功。")            return answer        except Exception as e:            print(f"调用LLM API时发生错误: {e}")            return "错误:调用语言模型服务时出错。"# --- 1. 配置LLM客户端 ---# 请根据您使用的服务,将这里替换成对应的凭证和地址llm = OpenAICompatibleClient(    model=config.AI_MODEL,    api_key=config.AI_KEY,    base_url=config.AI_URL)# --- 2. 初始化 ---user_prompt = input("请输入您的请求(例如:查询郑州的天气并推荐景点): ").strip()if not user_prompt:    print("未输入内容,程序退出。")    sys.exit(0)prompt_history = [f"用户请求: {user_prompt}"]print(f"用户输入: {user_prompt}\n" + "="*40)# --- 3. 运行主循环 ---for i in range(10): # 设置最大循环次数    print(f"--- 循环 {i+1} ---\n")    # 3.1. 构建Prompt    full_prompt = "\n".join(prompt_history)    # 3.2. 调用LLM进行思考    llm_output = llm.generate(full_prompt, system_prompt=AGENT_SYSTEM_PROMPT)    # 模型可能会输出多余的Thought-Action,需要截断    match = re.search(r'(Thought:.*?Action:.*?)(?=\n\s*(?:Thought:|Action:|Observation:)|\Z)', llm_output, re.DOTALL)    if match:        truncated = match.group(1).strip()        if truncated != llm_output.strip():            llm_output = truncated            print("已截断多余的 Thought-Action 对")    print(f"模型输出:\n{llm_output}\n")    prompt_history.append(llm_output)    # 3.3. 解析并执行行动    action_match = re.search(r"Action: (.*)", llm_output, re.DOTALL)    if not action_match:        print("解析错误:模型输出中未找到 Action。")        break    action_str = action_match.group(1).strip()    if action_str.startswith("finish"):        # 支持多种格式的 finish(answer=..),包含单/双引号并允许跨行内容        finish_match = re.search(r'finish\s*\(\s*answer\s*=\s*(?P<q>[\'\"])(?P<ans>.*?)(?P=q)\s*\)', action_str, re.DOTALL)        if finish_match:            final_answer = finish_match.group('ans')        else:            # 退回策略:尝试提取括号内的原始内容            inner = re.search(r'finish\s*\((.*)\)\s*$', action_str, re.DOTALL)            if inner:                final_answer = inner.group(1).strip()            else:                final_answer = action_str        print(f"任务完成,最终答案: {final_answer}")        break    tool_name = re.search(r"(\w+)\(", action_str).group(1)    args_str = re.search(r"\((.*)\)", action_str).group(1)    kwargs = dict(re.findall(r'(\w+)="([^"]*)"', args_str))    if tool_name in available_tools:        observation = available_tools[tool_name](**kwargs)    else:        observation = f"错误:未定义的工具 '{tool_name}'"    # 3.4. 记录观察结果    observation_str = f"Observation: {observation}"    print(f"{observation_str}\n" + "="*40)    prompt_history.append(observation_str)# print("\nPrompt History:", prompt_history)
#config.pyfrom dotenv import load_dotenvimport os# 加载 .env 文件load_dotenv()# 从 .env 获取环境变量AI_KEY = os.getenv('AI_KEY')AI_URL = os.getenv('AI_URL')AI_MODEL = os.getenv('AI_MODEL')TAVILY_API_KEY = os.getenv('TAVILY_API_KEY')# 打印加载的配置if __name__ == "__main__":    print("=== 环境变量配置 ===")    print(f"AI_KEY: {AI_KEY}")    print(f"AI_URL: {AI_URL}")    print(f"AI_MODEL: {AI_MODEL}")    print(f"TAVILY_API_KEY: {TAVILY_API_KEY}")

在.env 文件中配置你的 AI_KEY, AI_URL, AI_MODEL, TAVILY_API_KEY.

AI 正在从 Chat(对话)走向 Agent(行动)。希望这篇文章能帮你打开 AI 应用开发的大门。如果你觉得有用,欢迎 点赞、在看、转发

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-02-09 00:43:08 HTTP/2.0 GET : https://f.mffb.com.cn/a/460796.html
  2. 运行时间 : 0.161497s [ 吞吐率:6.19req/s ] 内存消耗:4,651.59kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=f282d31405efd259835dc4136e9e7328
  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.000504s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000567s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000740s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000398s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000585s ]
  6. SELECT * FROM `set` [ RunTime:0.008502s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000833s ]
  8. SELECT * FROM `article` WHERE `id` = 460796 LIMIT 1 [ RunTime:0.003408s ]
  9. UPDATE `article` SET `lasttime` = 1770568988 WHERE `id` = 460796 [ RunTime:0.012766s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000658s ]
  11. SELECT * FROM `article` WHERE `id` < 460796 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.006952s ]
  12. SELECT * FROM `article` WHERE `id` > 460796 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000819s ]
  13. SELECT * FROM `article` WHERE `id` < 460796 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.004430s ]
  14. SELECT * FROM `article` WHERE `id` < 460796 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.014926s ]
  15. SELECT * FROM `article` WHERE `id` < 460796 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.024247s ]
0.164945s