当前位置:首页>python>Python 神器 FastMCP:构建你的第一个 MCP 服务器

Python 神器 FastMCP:构建你的第一个 MCP 服务器

  • 2026-03-17 14:10:41
Python 神器 FastMCP:构建你的第一个 MCP 服务器

一行代码,就能让模型调用工具

你是否遇到过这样的场景?

好不容易训练了一个聪明的AI模型,却发现它“眼高手低”——能分析问题,却不会执行任务;能给出建议,却无法调用真实API;能理解需求,却连最简单的天气查询都做不到。

这不怪AI。大语言模型本质上是“思考者”,而不是“执行者”。它们擅长理解和生成文本,但缺乏与现实世界交互的“手”和“脚”。

今天,我要介绍一个改变游戏规则的技术:MCP(Model Context Protocol),以及它的Python利器——FastMCP。只需几行代码,你就能为AI模型装上“手脚”,让它从“纸上谈兵”变成“实干家”。

一、MCP:AI的“标准接口”

1.1 什么是MCP?

MCP(Model Context Protocol) 是一个标准化协议,它定义了AI客户端(如IDE插件、桌面应用、Web界面)如何安全地调用工具和获取资源。

简单来说,MCP就是:

“AI代理的REST API——但更智能、更标准化”

想象一下,如果没有MCP,每个AI应用都要自己造一套插件系统,就像每个电器都要用不同的插座一样混乱。MCP提供了统一的标准接口,让AI能够:

  • 发现可用工具(像浏览应用商店)
  • 调用工具并传递结构化参数(像函数调用)
  • 接收结构化结果(像API响应)

1.2 为什么选择FastMCP?

在Python生态中,FastMCP 是最优雅的MCP实现之一。它把底层的协议细节封装成简洁的装饰器API,让你可以:

# 就这么简单!
@mcp.tool
defget_weather(city: str) -> dict:
"""查询城市天气"""
# 你的业务逻辑
return weather_data

FastMCP为你自动处理:

  • 工具注册和发现
  • 参数验证和类型安全
  • 传输层(stdio/HTTP)
  • 生产环境就绪

二、手把手:构建你的第一个MCP服务器

2.1 环境准备:5分钟搞定

首先,创建一个干净的Python环境:

# 创建虚拟环境(推荐)
python -m venv mcp-env

# 激活环境
# macOS/Linux
source mcp-env/bin/activate
# Windows
mcp-env\Scripts\activate

# 安装FastMCP
pip install fastmcp requests

检查安装是否成功:

python -c "import fastmcp; print(f'FastMCP版本: {fastmcp.__version__}')"

2.2 第一个工具:让AI会查天气

创建文件 weather_server.py

from fastmcp import FastMCP

# 初始化MCP服务器,给它起个名字
mcp = FastMCP("Weather-Server")

@mcp.tool
defget_weather(city: str) -> dict:
"""
    查询指定城市的当前天气情况

    参数:
        city: 城市名称(如"北京"、"Tokyo")

    返回:
        包含天气信息的字典
    """

# 这里是模拟数据,实际可以连接真实API
    weather_database = {
"beijing": {"temp"22"condition""晴朗""humidity"45},
"shanghai": {"temp"25"condition""多云""humidity"65},
"tokyo": {"temp"18"condition""小雨""humidity"70},
"new york": {"temp"15"condition""阴天""humidity"60},
    }

    city_key = city.lower().strip()

if city_key in weather_database:
return {
"city": city,
"temperature_c": weather_database[city_key]["temp"],
"condition": weather_database[city_key]["condition"],
"humidity_percent": weather_database[city_key]["humidity"],
"source""模拟数据"
        }
else:
# 默认返回
return {
"city": city,
"temperature_c"20,
"condition""未知",
"humidity_percent"50,
"note""城市不在数据库中,返回默认值",
"source""模拟数据"
        }

@mcp.tool
defcelsius_to_fahrenheit(celsius: float) -> dict:
"""
    将摄氏度转换为华氏度

    参数:
        celsius: 摄氏度温度值

    返回:
        转换后的华氏度温度
    """

    fahrenheit = (celsius * 9/5) + 32
return {
"celsius": celsius,
"fahrenheit": round(fahrenheit, 1),
"formula""℉ = (℃ × 9/5) + 32"
    }

if __name__ == "__main__":
# 使用stdio传输,适合本地开发和AI代理框架
    print("🌤️ 天气MCP服务器启动中...")
    mcp.run(transport="stdio")

关键点解析:

  1. FastMCP("Weather-Server") 创建服务器实例
  2. @mcp.tool 装饰器将普通函数变成MCP工具
  3. 函数文档字符串会自动成为工具描述
  4. 参数类型提示(city: str)会被自动转换为JSON Schema

2.3 测试客户端:眼见为实

创建 test_client.py 来测试我们的服务器:

import asyncio
from fastmcp import Client

asyncdeftest_weather_server():
"""测试MCP服务器"""

# 创建客户端,指向我们的服务器文件
    client = Client("weather_server.py")

asyncwith client:
# 1. 查看所有可用工具
        print("🔧 可用的工具列表:")
        print("-" * 40)

        tools = await client.list_tools()
for tool in tools:
            print(f"  • {tool.name}")
            print(f"    描述: {tool.description}")
            print(f"    参数: {[p.name for p in tool.inputSchema['properties'].keys()]}")
            print()

        print("=" * 60)

# 2. 测试查询天气
        print("🌍 测试天气查询:")
        print("-" * 40)

        test_cities = ["Beijing""Tokyo""Paris"]

for city in test_cities:
            print(f"\n查询 {city} 的天气...")
            result = await client.call_tool("get_weather", {"city": city})

            print(f"  温度: {result['temperature_c']}°C")
            print(f"  天气: {result['condition']}")
            print(f"  湿度: {result['humidity_percent']}%")

        print("\n" + "=" * 60)

# 3. 测试温度转换
        print("🌡️ 测试温度转换:")
        print("-" * 40)

        test_temps = [02037.5100]  # 水的冰点、室温、体温、沸点

for temp in test_temps:
            result = await client.call_tool(
"celsius_to_fahrenheit"
                {"celsius": temp}
            )
            print(f"  {temp}°C = {result['fahrenheit']}°F")

asyncdefmain():
"""主函数"""
    print("🚀 开始测试MCP服务器...\n")
await test_weather_server()
    print("\n✅ 测试完成!")

if __name__ == "__main__":
    asyncio.run(main())

运行测试:

python test_client.py

你会看到类似这样的输出:

🚀 开始测试MCP服务器...

🔧 可用的工具列表:
----------------------------------------
  • get_weather
    描述: 查询指定城市的当前天气情况...
    参数: ['city']

  • celsius_to_fahrenheit
    描述: 将摄氏度转换为华氏度...
    参数: ['celsius']

============================================================
🌍 测试天气查询:
----------------------------------------

查询 Beijing 的天气...
  温度: 22°C
  天气: 晴朗
  湿度: 45%

查询 Tokyo 的天气...
  温度: 18°C
  天气: 小雨
  湿度: 70%

查询 Paris 的天气...
  温度: 20°C
  天气: 未知
  湿度: 50%

============================================================
🌡️ 测试温度转换:
----------------------------------------
  0°C = 32.0°F
  20°C = 68.0°F
  37.5°C = 99.5°F
  100°C = 212.0°F

✅ 测试完成!

三、升级版:连接真实API

模拟数据不够过瘾?让我们连接真实的天气API!

3.1 获取OpenWeatherMap API密钥

  1. 访问 OpenWeatherMap
  2. 注册免费账户(每月1000次调用,足够学习使用)
  3. 在控制台获取API Key

3.2 环境变量配置(安全最佳实践)

# 设置环境变量(不要硬编码密钥!)
export OPENWEATHER_API_KEY="your_api_key_here"

# 验证设置
echo$OPENWEATHER_API_KEY

3.3 升级服务器:连接真实天气数据

更新 weather_server.py

import os
import requests
from typing import Optional
from fastmcp import FastMCP

# 初始化MCP服务器
mcp = FastMCP("Real-Weather-Server")

# OpenWeatherMap API配置
OPENWEATHER_BASE_URL = "https://api.openweathermap.org/data/2.5/weather"
OPENWEATHER_API_KEY = os.getenv("OPENWEATHER_API_KEY")

@mcp.tool
defget_real_weather(
    city: str, 
    country_code: Optional[str] = None,
    units: str = "metric"
)
 -> dict:

"""
    使用OpenWeatherMap API查询真实天气数据

    参数:
        city: 城市名称(如"Beijing")
        country_code: 国家代码(可选,如"CN")
        units: 温度单位 - "metric"(摄氏度), "imperial"(华氏度), "standard"(开尔文)

    返回:
        包含详细天气信息的字典
    """

# 安全检查
ifnot OPENWEATHER_API_KEY:
return {
"error""API密钥未配置",
"solution""请设置OPENWEATHER_API_KEY环境变量",
"hint"'export OPENWEATHER_API_KEY="your_key_here"'
        }

# 构建查询参数
    query = f"{city},{country_code}"if country_code else city

    params = {
"q": query,
"appid": OPENWEATHER_API_KEY,
"units": units,
"lang""zh_cn"# 中文描述
    }

try:
# 调用API
        response = requests.get(OPENWEATHER_BASE_URL, params=params, timeout=10)
        response.raise_for_status()  # 检查HTTP错误
        data = response.json()

# 提取并格式化数据
        weather_info = {
"city": data.get("name", city),
"country": data.get("sys", {}).get("country""未知"),
"coordinates": {
"lon": data["coord"]["lon"],
"lat": data["coord"]["lat"]
            },
"temperature": {
"current": data["main"]["temp"],
"feels_like": data["main"]["feels_like"],
"min": data["main"]["temp_min"],
"max": data["main"]["temp_max"]
            },
"pressure_hpa": data["main"]["pressure"],
"humidity_percent": data["main"]["humidity"],
"weather": {
"main": data["weather"][0]["main"],
"description": data["weather"][0]["description"],
"icon": data["weather"][0]["icon"]
            },
"wind": {
"speed": data["wind"]["speed"],
"direction_deg": data["wind"].get("deg"0),
"gust": data["wind"].get("gust"0)
            },
"cloudiness_percent": data["clouds"]["all"],
"visibility_meters": data.get("visibility"10000),
"timestamp": data["dt"],
"timezone_offset": data["timezone"],
"data_source""OpenWeatherMap",
"units": units
        }

# 添加单位说明
if units == "metric":
            weather_info["temperature_unit"] = "°C"
            weather_info["wind_speed_unit"] = "m/s"
elif units == "imperial":
            weather_info["temperature_unit"] = "°F"
            weather_info["wind_speed_unit"] = "mph"

return weather_info

except requests.exceptions.HTTPError as e:
if response.status_code == 401:
return {"error""API密钥无效""status_code"401}
elif response.status_code == 404:
return {"error"f"找不到城市: {city}""status_code"404}
else:
return {"error"f"API请求失败: {str(e)}""status_code": response.status_code}

except requests.exceptions.RequestException as e:
return {"error"f"网络错误: {str(e)}""type""network_error"}

except (KeyError, IndexError) as e:
return {"error"f"数据解析失败: {str(e)}""type""data_parsing_error"}

@mcp.tool
defget_air_pollution(lat: float, lon: float) -> dict:
"""
    获取指定坐标的空气污染指数

    参数:
        lat: 纬度 (-90 到 90)
        lon: 经度 (-180 到 180)

    返回:
        空气污染数据
    """

# 注意:空气污染API需要单独的调用
# 这里提供框架,实际需要OpenWeatherMap的air_pollution端点
return {
"coordinates": {"lat": lat, "lon": lon},
"note""需要OpenWeatherMap的air_pollution API订阅",
"suggestion""查看 https://openweathermap.org/api/air-pollution"
    }

@mcp.tool  
defformat_weather_summary(weather_data: dict) -> str:
"""
    将天气数据格式化为友好的人类可读摘要

    参数:
        weather_data: get_real_weather返回的天气数据

    返回:
        格式化的天气摘要字符串
    """

if"error"in weather_data:
returnf"❌ 获取天气数据失败: {weather_data['error']}"

try:
        city = weather_data["city"]
        country = weather_data.get("country""")
        temp = weather_data["temperature"]["current"]
        temp_unit = weather_data.get("temperature_unit""°C")
        condition = weather_data["weather"]["description"]
        humidity = weather_data["humidity_percent"]

        location = f"{city}{country}"if country else city

        summary = f"""
🌤️ {location} 天气报告
----------------------------
🌡️ 当前温度: {temp}{temp_unit} (体感: {weather_data['temperature']['feels_like']}{temp_unit})
🌪️ 天气状况: {condition}
💧 湿度: {humidity}%
☁️ 云量: {weather_data['cloudiness_percent']}%
🌬️ 风速: {weather_data['wind']['speed']}{weather_data.get('wind_speed_unit''m/s')}
📏 能见度: {weather_data['visibility_meters']}
📊 气压: {weather_data['pressure_hpa']} hPa
📅 数据时间: {weather_data['timestamp']}
        """
.strip()

return summary

except KeyError as e:
returnf"⚠️ 数据格式错误: 缺少字段 {str(e)}"

if __name__ == "__main__":
    print("🌍 真实天气MCP服务器启动...")
    print(f"📋 可用工具: get_real_weather, get_air_pollution, format_weather_summary")
    mcp.run(transport="stdio")

3.4 升级测试客户端

更新 test_client.py

import os
import asyncio
import sys
from fastmcp import Client
from fastmcp.client.transports import StdioTransport

asyncdeftest_real_weather():
"""测试真实天气API"""

# 准备环境变量(传递给服务器进程)
    env = os.environ.copy()

# 检查API密钥
if"OPENWEATHER_API_KEY"notin env:
        print("⚠️  警告: OPENWEATHER_API_KEY 环境变量未设置")
        print("   请运行: export OPENWEATHER_API_KEY='your_key_here'")
        print("   或直接在代码中设置: env['OPENWEATHER_API_KEY'] = 'your_key_here'")
return

# 创建传输层,显式传递环境变量
    transport = StdioTransport(
        command=sys.executable,  # 使用当前Python解释器
        args=["weather_server.py"],  # 服务器文件
        env=env,  # 传递环境变量
        cwd=os.getcwd()  # 当前工作目录
    )

    client = Client(transport)

asyncwith client:
        print("🔍 发现服务器工具...")
        tools = await client.list_tools()

for tool in tools:
            print(f"  ✓ {tool.name}{tool.description[:60]}...")

        print("\n" + "="*60)
        print("🌤️ 测试真实天气查询")
        print("="*60)

# 测试几个主要城市
        test_cases = [
            {"city""Beijing""country_code""CN"},
            {"city""Tokyo""country_code""JP"},
            {"city""London""country_code""GB"},
            {"city""New York""country_code""US"},
        ]

for case in test_cases:
            print(f"\n📍 查询 {case['city']}{case['country_code']}...")

# 调用天气查询
            weather_data = await client.call_tool(
"get_real_weather",
                {"city": case["city"], "country_code": case["country_code"]}
            )

if"error"in weather_data:
                print(f"   ❌ 错误: {weather_data['error']}")
continue

# 格式化显示
            summary = await client.call_tool(
"format_weather_summary",
                {"weather_data": weather_data}
            )

            print(f"   ✅ 成功获取数据:")
            print("   " + "\n   ".join(summary.split("\n")))

# 显示一些关键数据
            print(f"   📊 详细数据:")
            print(f"     温度范围: {weather_data['temperature']['min']}°C ~ {weather_data['temperature']['max']}°C")
            print(f"     风向: {weather_data['wind'].get('direction_deg''N/A')}°")
            print(f"     坐标: ({weather_data['coordinates']['lat']}{weather_data['coordinates']['lon']})")

        print("\n" + "="*60)
        print("🎯 高级功能测试")
        print("="*60)

# 测试华氏度单位
        print("\n🇺🇸 测试华氏度单位 (纽约)...")
        fahrenheit_data = await client.call_tool(
"get_real_weather",
            {"city""New York""country_code""US""units""imperial"}
        )

if"error"notin fahrenheit_data:
            print(f"   🌡️ 纽约当前温度: {fahrenheit_data['temperature']['current']}°F")

# 测试空气污染(需要付费API)
        print("\n🌫️ 测试空气污染查询...")
        pollution_data = await client.call_tool(
"get_air_pollution",
            {"lat"39.9042"lon"116.4074}  # 北京坐标
        )
        print(f"   {pollution_data.get('note''N/A')}")

asyncdefmain():
"""主函数"""
    print("🚀 MCP真实天气服务器测试")
    print("="*60)

await test_real_weather()

    print("\n" + "="*60)
    print("✅ 测试完成!")
    print("\n💡 提示: 现在你的AI助手可以调用这些工具了!")
    print("   例如在Claude Desktop、Cursor等支持MCP的工具中")

if __name__ == "__main__":
    asyncio.run(main())

运行真实API测试:

# 确保已设置API密钥
export OPENWEATHER_API_KEY="your_actual_key_here"

# 运行测试
python test_client.py

四、MCP在实际系统中的应用场景

4.1 MCP的“用武之地”

MCP不仅限于天气查询,它在真实系统中有着广泛的应用:

# 企业级MCP服务器示例架构
@mcp.tool
defquery_database(sql: str, params: dict = None) -> list:
"""安全地查询企业数据库"""
# 实际实现会包含权限验证、SQL注入防护等
pass

@mcp.tool  
defcall_internal_api(endpoint: str, payload: dict) -> dict:
"""调用内部REST API"""
pass

@mcp.tool
defgenerate_report(data_source: str, format: str = "pdf") -> dict:
"""生成业务报告"""
pass

@mcp.tool
defsend_notification(channel: str, message: str, priority: str = "normal") -> dict:
"""发送通知到各种渠道"""
pass

4.2 典型应用场景

  1. AI助手增强

    • ChatGPT/Claude插件开发
    • IDE智能编程助手
    • 企业内部知识问答系统
  2. 自动化工作流

    @mcp.tool
    defautomate_daily_report():
    """自动生成日报"""
    # 1. 从数据库拉取数据
    # 2. 分析关键指标
    # 3. 生成可视化图表
    # 4. 发送到Slack/邮件
    pass
  3. 数据平台集成

    • 连接Snowflake/Databricks
    • 实时数据查询
    • 特征工程管道
  4. 运维与监控

    @mcp.tool
    defcheck_system_health() -> dict:
    """检查系统健康状态"""
    return {
    "cpu_usage": get_cpu_usage(),
    "memory_usage": get_memory_usage(),
    "service_status": check_services(),
    "alerts": get_active_alerts()
        }

五、生产环境部署指南

5.1 使用HTTP传输(生产推荐)

# production_server.py
from fastmcp import FastMCP
import uvicorn

mcp = FastMCP("Production-Server", port=8000)

@mcp.tool
defproduction_tool():
"""生产环境工具"""
return {"status""ready"}

if __name__ == "__main__":
# HTTP模式,适合云部署
    mcp.run(transport="http", host="0.0.0.0", port=8000)

5.2 Docker化部署

# Dockerfile
FROM python:3.11-slim

WORKDIR /app

# 安装依赖
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# 复制代码
COPY . .

# 环境变量
ENV PORT=8000
ENV HOST=0.0.0.0

# 运行
CMD ["python""production_server.py"]

5.3 安全性考虑

# 添加认证中间件
from fastmcp import FastMCP
from fastmcp.middleware import AuthMiddleware

mcp = FastMCP("Secure-Server")

# 添加API密钥验证
@mcp.middleware
asyncdefauth_middleware(call, next_fn):
    api_key = call.context.get("headers", {}).get("x-api-key")

ifnot validate_api_key(api_key):
raise PermissionError("Invalid API key")

returnawait next_fn(call)

写在最后

通过本文,你已经掌握了:

  1. MCP的核心概念:AI代理的标准接口协议
  2. FastMCP的基本使用:用装饰器快速构建工具
  3. 真实API集成:连接OpenWeatherMap获取实时数据
  4. 生产级考虑:环境变量、错误处理、部署方案

MCP的真正威力在于标准化和可组合性。一旦你建立了一套MCP工具,它们可以被任何兼容MCP的AI客户端使用——无论是Claude Desktop、Cursor,还是你自定义的AI应用。

🏴‍☠️宝藏级🏴‍☠️ 原创公众号『数据STUDIO』内容超级硬核。公众号以Python为核心语言,垂直于数据科学领域,包括可戳👉PythonMySQL数据分析数据可视化机器学习与数据挖掘爬虫等,从入门到进阶!

长按👇关注- 数据STUDIO -设为星标,干货速递

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-03-27 10:07:14 HTTP/2.0 GET : https://f.mffb.com.cn/a/479946.html
  2. 运行时间 : 0.240327s [ 吞吐率:4.16req/s ] 内存消耗:4,808.80kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=3ab53131034e68d72e1a831d920fff16
  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.001060s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001512s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.001114s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.008981s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000789s ]
  6. SELECT * FROM `set` [ RunTime:0.002555s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000603s ]
  8. SELECT * FROM `article` WHERE `id` = 479946 LIMIT 1 [ RunTime:0.003013s ]
  9. UPDATE `article` SET `lasttime` = 1774577234 WHERE `id` = 479946 [ RunTime:0.009809s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000289s ]
  11. SELECT * FROM `article` WHERE `id` < 479946 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.001580s ]
  12. SELECT * FROM `article` WHERE `id` > 479946 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000415s ]
  13. SELECT * FROM `article` WHERE `id` < 479946 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.004237s ]
  14. SELECT * FROM `article` WHERE `id` < 479946 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.001686s ]
  15. SELECT * FROM `article` WHERE `id` < 479946 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.008385s ]
0.241965s