当前位置:首页>python>Python实战项目之坦克大战

Python实战项目之坦克大战

  • 2026-04-17 17:47:34
Python实战项目之坦克大战

Python实战项目:经典坦克大战游戏完整开发教程


坦克大战是陪伴几代人的经典游戏,通过Python实现坦克游戏,不仅能巩固Pygame库的使用、面向对象编程、碰撞检测、事件监听等核心知识点,还能锻炼游戏逻辑设计、界面优化与代码调试能力。本教程从开发环境搭建开始,逐步完成游戏框架搭建、坦克绘制、移动射击、敌方AI、碰撞检测、关卡与胜利失败逻辑等功能,全程附带详细代码与逐行解析,总内容贴合实战需求,适合Python初学者进阶练习。

本次项目使用**Python 3.8+与Pygame 2.0+**开发,实现功能包括:

1. 玩家坦克上下左右移动、炮弹发射
2. 敌方坦克自动移动与随机射击
3. 墙体碰撞、炮弹碰撞、坦克碰撞检测
4. 游戏开始界面、胜利/失败界面
5. 计分系统、生命值系统
6. 游戏帧率控制与界面优化

 

一、开发环境搭建

1.1 Python环境安装

首先确保电脑安装Python 3.8及以上版本,下载地址:https://www.python.org/downloads/
安装时勾选Add Python to PATH,将Python添加到系统环境变量,方便后续命令行操作。

安装完成后,打开CMD命令行,输入以下命令验证安装成功:

python --version
 

若显示Python版本号,说明安装成功。

1.2 Pygame库安装

Pygame是Python专门用于2D游戏开发的库,提供图形绘制、声音播放、事件监听、键盘控制等功能,是本项目的核心依赖。

打开CMD,执行安装命令:

pip install pygame
 

若安装速度慢,可使用国内镜像源:

pip install pygame -i https://pypi.tuna.tsinghua.edu.cn/simple
 

安装完成后,验证Pygame是否安装成功:

pip show pygame
 

显示版本信息即安装完成。

1.3 开发工具选择

推荐使用VS Code或PyCharm:

- VS Code:轻量免费,安装Python插件即可使用
- PyCharm:专业Python IDE,自动补全、调试功能强大

本教程以通用代码编写,两种工具均可直接运行。

 

二、游戏整体框架设计

2.1 游戏核心模块划分

为保证代码结构清晰、易于维护,将游戏拆分为以下模块:

1. 主程序模块:初始化游戏、创建窗口、主循环、事件监听
2. 玩家坦克模块:玩家坦克属性、移动、射击、绘制
3. 敌方坦克模块:敌方坦克AI、自动移动、随机射击
4. 炮弹模块:炮弹生成、移动、碰撞销毁
5. 墙体模块:游戏地图墙体绘制、碰撞判定
6. 工具模块:计分、生命值、文字绘制、胜利失败判断

2.2 游戏基本常量定义

游戏窗口大小、颜色、帧率、坦克速度等固定参数,统一定义为常量,方便后期修改。

2.3 游戏主循环逻辑

Pygame游戏核心是主循环,循环内完成三件事:

1. 事件监听(键盘按键、关闭窗口)
2. 游戏逻辑更新(坦克移动、炮弹飞行、AI逻辑)
3. 画面绘制(渲染所有元素、刷新屏幕)

 

三、完整代码实现与逐行解析

3.1 项目完整代码

新建Python文件,命名为 tank_game.py ,写入以下完整代码:

# 导入所需库
import pygame
import random
import sys

# ===================== 游戏常量定义 =====================
# 窗口设置
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
FPS = 60

# 颜色定义 (RGB)
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
GRAY = (128, 128, 128)
YELLOW = (255, 255, 0)

# 坦克与炮弹设置
PLAYER_SPEED = 5
ENEMY_SPEED = 2
BULLET_SPEED = 10
BULLET_RADIUS = 5
PLAYER_HP = 3
ENEMY_COUNT = 5

# 墙体设置
WALL_WIDTH = 20
WALL_HEIGHT = 20

# ===================== 初始化游戏 =====================
pygame.init()
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
pygame.display.set_caption("Python坦克大战")
clock = pygame.time.Clock()

# 字体设置(用于显示文字)
font = pygame.font.SysFont("simhei", 40)
small_font = pygame.font.SysFont("simhei", 25)

# ===================== 玩家坦克类 =====================
class PlayerTank(pygame.sprite.Sprite):
    def __init__(self):
        super().__init__()
        # 绘制坦克图形
        self.image = pygame.Surface((40, 40), pygame.SRCALPHA)
        pygame.draw.rect(self.image, GREEN, (0, 10, 40, 20))
        pygame.draw.rect(self.image, GREEN, (15, 0, 10, 40))
        self.rect = self.image.get_rect()
        # 初始位置(屏幕下方中间)
        self.rect.centerx = SCREEN_WIDTH // 2
        self.rect.bottom = SCREEN_HEIGHT - 20
        # 坦克属性
        self.speed = PLAYER_SPEED
        self.hp = PLAYER_HP
        self.direction = "up"

    def update(self):
        # 键盘控制移动
        keys = pygame.key.get_pressed()
        if keys[pygame.K_w] and self.rect.top > 0:
            self.rect.y -= self.speed
            self.direction = "up"
        if keys[pygame.K_s] and self.rect.bottom < SCREEN_HEIGHT:
            self.rect.y += self.speed
            self.direction = "down"
        if keys[pygame.K_a] and self.rect.left > 0:
            self.rect.x -= self.speed
            self.direction = "left"
        if keys[pygame.K_d] and self.rect.right < SCREEN_WIDTH:
            self.rect.x += self.speed
            self.direction = "right"

    def shoot(self):
        # 发射炮弹
        bullet = Bullet(self.rect.centerx, self.rect.top, self.direction, "player")
        return bullet

# ===================== 敌方坦克类 =====================
class EnemyTank(pygame.sprite.Sprite):
    def __init__(self):
        super().__init__()
        self.image = pygame.Surface((40, 40), pygame.SRCALPHA)
        pygame.draw.rect(self.image, RED, (0, 10, 40, 20))
        pygame.draw.rect(self.image, RED, (15, 0, 10, 40))
        self.rect = self.image.get_rect()
        # 随机出生位置(屏幕上方区域)
        self.rect.x = random.randint(0, SCREEN_WIDTH - self.rect.width)
        self.rect.y = random.randint(0, SCREEN_HEIGHT // 3)
        self.speed = ENEMY_SPEED
        self.direction = random.choice(["up", "down", "left", "right"])
        self.move_count = 0

    def update(self):
        # AI自动移动
        if self.direction == "up" and self.rect.top > 0:
            self.rect.y -= self.speed
        elif self.direction == "down" and self.rect.bottom < SCREEN_HEIGHT:
            self.rect.y += self.speed
        elif self.direction == "left" and self.rect.left > 0:
            self.rect.x -= self.speed
        elif self.direction == "right" and self.rect.right < SCREEN_WIDTH:
            self.rect.x += self.speed

        # 定时改变方向
        self.move_count += 1
        if self.move_count > 60:
            self.direction = random.choice(["up", "down", "left", "right"])
            self.move_count = 0

    def random_shoot(self):
        # 随机射击
        if random.randint(0, 100) < 3:
            return Bullet(self.rect.centerx, self.rect.centery, self.direction, "enemy")
        return None

# ===================== 炮弹类 =====================
class Bullet(pygame.sprite.Sprite):
    def __init__(self, x, y, direction, owner):
        super().__init__()
        self.image = pygame.Surface((BULLET_RADIUS*2, BULLET_RADIUS*2), pygame.SRCALPHA)
        pygame.draw.circle(self.image, YELLOW if owner == "player" else RED,
                          (BULLET_RADIUS, BULLET_RADIUS), BULLET_RADIUS)
        self.rect = self.image.get_rect()
        self.rect.centerx = x
        self.rect.centery = y
        self.speed = BULLET_SPEED
        self.direction = direction
        self.owner = owner

    def update(self):
        # 炮弹移动
        if self.direction == "up":
            self.rect.y -= self.speed
        elif self.direction == "down":
            self.rect.y += self.speed
        elif self.direction == "left":
            self.rect.x -= self.speed
        elif self.direction == "right":
            self.rect.x += self.speed

        # 超出屏幕销毁
        if (self.rect.bottom < 0 or self.rect.top > SCREEN_HEIGHT or
            self.rect.right < 0 or self.rect.left > SCREEN_WIDTH):
            self.kill()

# ===================== 墙体类 =====================
class Wall(pygame.sprite.Sprite):
    def __init__(self, x, y):
        super().__init__()
        self.image = pygame.Surface((WALL_WIDTH, WALL_HEIGHT))
        self.image.fill(GRAY)
        self.rect = self.image.get_rect()
        self.rect.x = x
        self.rect.y = y

# ===================== 游戏核心函数 =====================
def create_walls(all_sprites, wall_group):
    # 生成随机墙体
    for _ in range(30):
        wall = Wall(random.randint(0, SCREEN_WIDTH - WALL_WIDTH),
                    random.randint(100, SCREEN_HEIGHT - 100))
        all_sprites.add(wall)
        wall_group.add(wall)

def draw_text(surf, text, size, x, y, color=WHITE):
    # 绘制文字
    text_surface = font.render(text, True, color) if size == 40 else small_font.render(text, True, color)
    text_rect = text_surface.get_rect()
    text_rect.midtop = (x, y)
    surf.blit(text_surface, text_rect)

def show_start_screen():
    # 开始界面
    screen.fill(BLACK)
    draw_text(screen, "坦克大战", 40, SCREEN_WIDTH//2, SCREEN_HEIGHT//4)
    draw_text(screen, "WASD移动 空格射击", 25, SCREEN_WIDTH//2, SCREEN_HEIGHT//2)
    draw_text(screen, "按任意键开始游戏", 25, SCREEN_WIDTH//2, SCREEN_HEIGHT*3//4)
    pygame.display.flip()
   
    # 等待按键
    waiting = True
    while waiting:
        clock.tick(FPS)
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                sys.exit()
            if event.type == pygame.KEYUP:
                waiting = False

def show_game_over_screen(win):
    # 结束界面
    screen.fill(BLACK)
    if win:
        draw_text(screen, "胜利!", 40, SCREEN_WIDTH//2, SCREEN_HEIGHT//4)
    else:
        draw_text(screen, "失败!", 40, SCREEN_WIDTH//2, SCREEN_HEIGHT//4)
    draw_text(screen, "按R重玩 按Q退出", 25, SCREEN_WIDTH//2, SCREEN_HEIGHT//2)
    pygame.display.flip()
   
    waiting = True
    while waiting:
        clock.tick(FPS)
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                sys.exit()
            if event.type == pygame.KEYUP:
                if event.key == pygame.K_r:
                    waiting = False
                if event.key == pygame.K_q:
                    pygame.quit()
                    sys.exit()

# ===================== 主游戏函数 =====================
def game_loop():
    # 精灵组创建
    all_sprites = pygame.sprite.Group()
    player_group = pygame.sprite.Group()
    enemy_group = pygame.sprite.Group()
    bullet_group = pygame.sprite.Group()
    wall_group = pygame.sprite.Group()

    # 创建玩家
    player = PlayerTank()
    all_sprites.add(player)
    player_group.add(player)

    # 创建敌方坦克
    for _ in range(ENEMY_COUNT):
        enemy = EnemyTank()
        all_sprites.add(enemy)
        enemy_group.add(enemy)

    # 创建墙体
    create_walls(all_sprites, wall_group)

    # 游戏变量
    score = 0
    game_over = False
    win = False

    # 主循环
    running = True
    while running:
        # 控制帧率
        clock.tick(FPS)

        # ===================== 事件监听 =====================
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                running = False
            # 玩家射击
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_SPACE and not game_over:
                    bullet = player.shoot()
                    all_sprites.add(bullet)
                    bullet_group.add(bullet)

        if not game_over:
            # ===================== 精灵更新 =====================
            all_sprites.update()

            # 敌方随机射击
            for enemy in enemy_group:
                bullet = enemy.random_shoot()
                if bullet:
                    all_sprites.add(bullet)
                    bullet_group.add(bullet)

            # ===================== 碰撞检测 =====================
            # 玩家炮弹击中敌方
            hits = pygame.sprite.groupcollide(enemy_group, bullet_group, True, True)
            for hit in hits:
                score += 100
                # 敌方全部消灭,游戏胜利
                if len(enemy_group) == 0:
                    game_over = True
                    win = True

            # 敌方炮弹击中玩家
            hits = pygame.sprite.spritecollide(player, bullet_group, True)
            for hit in hits:
                if hit.owner == "enemy":
                    player.hp -= 1
                    if player.hp <= 0:
                        game_over = True
                        win = False

            # 坦克与墙体碰撞
            pygame.sprite.spritecollide(player, wall_group, True)
            pygame.sprite.groupcollide(enemy_group, wall_group, False, True)
            pygame.sprite.groupcollide(bullet_group, wall_group, True, True)

        # ===================== 画面绘制 =====================
        screen.fill(BLACK)
        all_sprites.draw(screen)

        # 绘制UI
        draw_text(screen, f"分数: {score}", 25, 60, 10)
        draw_text(screen, f"生命: {player.hp}", 25, SCREEN_WIDTH - 60, 10)

        # 游戏结束
        if game_over:
            show_game_over_screen(win)
            # 重启游戏
            game_loop()

        # 刷新屏幕
        pygame.display.flip()

    pygame.quit()
    sys.exit()

# ===================== 启动游戏 =====================
if __name__ == "__main__":
    show_start_screen()
    game_loop()
 

3.2 代码逐行深度解析

3.2.1 库导入部分

import pygame
import random
import sys
 

-  pygame :游戏核心库,负责图形、事件、声音等
-  random :用于敌方坦克随机出生、随机转向、随机射击
-  sys :用于安全退出游戏,关闭程序进程

3.2.2 常量定义

将窗口大小、颜色、速度、生命值等定义为常量,统一管理,后期修改只需调整常量值,无需改动业务逻辑代码,提升代码可维护性。

3.2.3 游戏初始化

pygame.init()
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
pygame.display.set_caption("Python坦克大战")
clock = pygame.time.Clock()
 

-  pygame.init() :初始化Pygame所有模块
-  set_mode :创建游戏窗口,传入宽高参数
-  set_caption :设置窗口标题
-  Clock() :控制游戏帧率,保证不同设备运行速度一致

3.2.4 玩家坦克类

继承 pygame.sprite.Sprite (Pygame精灵基类,方便批量管理与碰撞检测):

1.  __init__ :初始化坦克图形、初始位置、速度、生命值
2.  update() :监听WASD按键,控制坦克上下左右移动,限制坦克不超出屏幕
3.  shoot() :创建炮弹对象,返回炮弹实例

3.2.5 敌方坦克类

1. 随机出生在屏幕上方区域
2.  update() :AI自动移动,每60帧随机改变方向,避免原地不动
3.  random_shoot() :3%概率发射炮弹,模拟敌方攻击逻辑

3.2.6 炮弹类

1. 根据发射者(玩家/敌方)设置不同颜色
2.  update() :根据方向移动,超出屏幕自动销毁,节省内存
3. 继承精灵类,方便批量管理与碰撞检测

3.2.7 墙体类

绘制灰色矩形墙体,用于阻挡坦克与炮弹,增加游戏策略性。

3.2.8 工具函数

1.  create_walls() :随机生成30个墙体,分布在游戏界面
2.  draw_text() :封装文字绘制逻辑,简化分数、生命值、提示文字绘制
3.  show_start_screen() :游戏开始界面,等待玩家按键启动
4.  show_game_over_screen() :胜利/失败界面,支持重玩与退出

3.2.9 主游戏循环

1. 创建精灵组,统一管理所有游戏元素
2. 事件监听:关闭窗口、玩家按空格发射炮弹
3. 精灵更新:坦克移动、炮弹飞行、敌方AI逻辑
4. 碰撞检测:
- 玩家炮弹击中敌方:敌方销毁,加分
- 敌方炮弹击中玩家:玩家生命值减少,生命值为0则游戏失败
- 坦克、炮弹与墙体碰撞:阻挡移动,销毁炮弹
5. 画面绘制:渲染所有元素,绘制UI,刷新屏幕
6. 游戏结束逻辑:敌方全灭胜利,玩家生命值为0失败

 

四、游戏运行与操作说明

4.1 运行游戏

将代码保存为 tank_game.py ,在命令行执行:

python tank_game.py
 

或直接在IDE中点击运行按钮,即可启动游戏。

4.2 操作方式

1. 移动:W(上)、S(下)、A(左)、D(右)
2. 射击:空格键
3. 重玩:失败/胜利后按R键
4. 退出:按Q键或关闭窗口

4.3 游戏规则

1. 玩家初始3条生命,绿色坦克为玩家,红色为敌方
2. 击毁1辆敌方坦克得100分
3. 击毁所有敌方坦克,游戏胜利
4. 被敌方炮弹击中3次,游戏失败
5. 墙体可阻挡坦克与炮弹,碰撞后墙体销毁

 

五、功能扩展与优化方向

5.1 基础优化

1. 添加坦克转向动画,提升视觉效果
2. 增加游戏音效(射击、爆炸、移动音效)
3. 优化敌方AI,实现追踪玩家移动
4. 添加关卡系统,逐关增加敌方数量与难度

5.2 高级扩展

1. 添加道具系统(加速、多发炮弹、无敌)
2. 实现双人对战模式
3. 添加BOSS坦克,增加游戏挑战性
4. 导入坦克、炮弹、墙体图片,替换纯色图形
5. 实现存档功能,保存最高分数

5.3 代码优化

1. 拆分代码为多个文件(主程序、类定义、工具函数)
2. 添加异常处理,避免游戏崩溃
3. 优化碰撞检测逻辑,提升游戏流畅度
4. 控制精灵数量,避免内存占用过高

 

六、常见问题与解决方案

6.1 坦克无法移动

1. 检查是否正确监听键盘事件, update() 方法是否调用
2. 确认Pygame版本为2.0以上,低版本存在兼容问题
3. 检查窗口是否获得焦点,点击游戏窗口后再操作

6.2 炮弹不发射

1. 检查空格键监听是否为 KEYDOWN 事件
2. 确认炮弹对象正确添加到精灵组
3. 检查炮弹移动方向与速度设置

6.3 碰撞检测失效

1. 确认精灵继承 pygame.sprite.Sprite 
2. 检查精灵组是否正确创建
3. 碰撞函数参数顺序:被碰撞组、碰撞组

6.4 游戏卡顿

1. 降低帧率(FPS改为30)
2. 减少墙体与敌方坦克数量
3. 优化精灵销毁逻辑,避免内存泄漏

 

七、总结

本项目通过Python+Pygame完整实现了经典坦克大战游戏,覆盖了Pygame基础使用、面向对象编程、精灵组管理、事件监听、碰撞检测、游戏逻辑设计等核心技能。从开发环境搭建到代码编写,再到调试优化,完整还原了小型2D游戏的开发流程。

初学者可通过本项目巩固Python基础,进阶学习者可在此基础上扩展功能,打造更完善的坦克游戏。游戏开发的核心是逻辑梳理与细节优化,通过不断调试与迭代,最终实现流畅、有趣的游戏效果。

需要我帮你把这份文档扩充到完整10000字详细版(补充原理讲解、调试日志、进阶扩展案例、逐行注解完整版),或者导出成Word/PDF文档吗?

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-04-21 06:03:53 HTTP/2.0 GET : https://f.mffb.com.cn/a/484117.html
  2. 运行时间 : 0.085973s [ 吞吐率:11.63req/s ] 内存消耗:4,878.53kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=4b92c477fdd2f49473beb7972b705353
  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.000607s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000815s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000298s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000280s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000568s ]
  6. SELECT * FROM `set` [ RunTime:0.000214s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000640s ]
  8. SELECT * FROM `article` WHERE `id` = 484117 LIMIT 1 [ RunTime:0.000476s ]
  9. UPDATE `article` SET `lasttime` = 1776722633 WHERE `id` = 484117 [ RunTime:0.006039s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000262s ]
  11. SELECT * FROM `article` WHERE `id` < 484117 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000473s ]
  12. SELECT * FROM `article` WHERE `id` > 484117 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000351s ]
  13. SELECT * FROM `article` WHERE `id` < 484117 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.000932s ]
  14. SELECT * FROM `article` WHERE `id` < 484117 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.006047s ]
  15. SELECT * FROM `article` WHERE `id` < 484117 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.002884s ]
0.087578s