当前位置:首页>python>Python利用pytest和selenium实现自动化测试完整指南

Python利用pytest和selenium实现自动化测试完整指南

  • 2026-08-18 23:10:36
Python利用pytest和selenium实现自动化测试完整指南

自动化测试是现代软件开发中不可或缺的一环,Python作为一门简洁优雅的编程语言,配合pytest测试框架和selenium自动化工具,为我们提供了强大的自动化测试解决方案。

前言

自动化测试是现代软件开发中不可或缺的一环。Python作为一门简洁优雅的编程语言,配合pytest测试框架和selenium自动化工具,为我们提供了强大的自动化测试解决方案。

本教程将从零开始,带领大家掌握Python自动化测试的核心技能,通过实战项目学会如何构建稳定、高效的自动化测试体系。

环境搭建

安装Python和依赖包

# 创建虚拟环境python -m venv test_envsource test_env/bin/activate  # Windows: test_env\Scripts\activate# 安装核心依赖pip install pytest selenium webdriver-manager pytest-html allure-pytest

浏览器驱动配置

# 使用webdriver-manager自动管理驱动from webdriver_manager.chrome import ChromeDriverManagerfrom selenium import webdriverfrom selenium.webdriver.chrome.service import Servicedef setup_driver():    service = Service(ChromeDriverManager().install())    driver = webdriver.Chrome(service=service)    return driver

项目结构搭建

automation_project/├── tests/│   ├── __init__.py│   ├── test_login.py│   └── test_search.py├── pages/│   ├── __init__.py│   ├── base_page.py│   └── login_page.py├── utils/│   ├── __init__.py│   └── config.py├── drivers/├── reports/├── conftest.py├── pytest.ini└── requirements.txt

pytest基础教程

pytest核心概念

pytest是Python中最流行的测试框架,具有以下特点:

  • 简单易用的断言语法
  • 丰富的插件生态系统
  • 强大的fixture机制
  • 灵活的测试发现和执行

基础测试示例

# test_basic.pyimport pytestdef test_simple_assert():    """基础断言测试"""    assert 1 + 1 == 2def test_string_operations():    """字符串操作测试"""    text = "Hello, World!"    assert "Hello" in text    assert text.startswith("Hello")    assert text.endswith("!")class TestCalculator:    """测试类示例"""    def test_addition(self):        assert 2 + 3 == 5    def test_division(self):        assert 10 / 2 == 5    def test_division_by_zero(self):        with pytest.raises(ZeroDivisionError):            10 / 0

fixture机制深入

# conftest.pyimport pytestfrom selenium import webdriverfrom webdriver_manager.chrome import ChromeDriverManager@pytest.fixture(scope="session")def driver():    """会话级别的浏览器驱动"""    options = webdriver.ChromeOptions()    options.add_argument("--headless")  # 无头模式    driver = webdriver.Chrome(        service=Service(ChromeDriverManager().install()),        options=options    )    yield driver    driver.quit()@pytest.fixturedef test_data():    """测试数据fixture"""    return {        "username""test@example.com",        "password""password123"    }

参数化测试

# test_parametrize.pyimport pytest@pytest.mark.parametrize("a,b,expected", [    (235),    (112),    (055),    (-110)])def test_addition(a, b, expected):    assert a + b == expected@pytest.mark.parametrize("url", [    "https://www.baidu.com",    "https://www.google.com"])def test_website_accessibility(driver, url):    driver.get(url)    assert driver.title

selenium基础教程

元素定位策略

from selenium.webdriver.common.by import Byfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.support import expected_conditions as ECclass ElementLocator:    """元素定位封装类"""    def __init__(self, driver):        self.driver = driver        self.wait = WebDriverWait(driver, 10)    def find_element_safely(self, locator):        """安全查找元素"""        try:            element = self.wait.until(EC.presence_of_element_located(locator))            return element        except TimeoutException:            print(f"元素定位失败: {locator}")            return None    def click_element(self, locator):        """点击元素"""        element = self.wait.until(EC.element_to_be_clickable(locator))        element.click()    def input_text(self, locator, text):        """输入文本"""        element = self.find_element_safely(locator)        if element:            element.clear()            element.send_keys(text)

常用操作封装

# utils/selenium_helper.pyfrom selenium.webdriver.support.ui import Selectfrom selenium.webdriver.common.action_chains import ActionChainsfrom selenium.webdriver.common.keys import Keysclass SeleniumHelper:    """Selenium操作助手类"""    def __init__(self, driver):        self.driver = driver    def scroll_to_element(self, element):        """滚动到指定元素"""        self.driver.execute_script("arguments[0].scrollIntoView();", element)    def select_dropdown_by_text(self, locator, text):        """通过文本选择下拉框"""        select = Select(self.driver.find_element(*locator))        select.select_by_visible_text(text)    def hover_element(self, element):        """鼠标悬停"""        actions = ActionChains(self.driver)        actions.move_to_element(element).perform()    def switch_to_iframe(self, iframe_locator):        """切换到iframe"""        iframe = self.driver.find_element(*iframe_locator)        self.driver.switch_to.frame(iframe)    def take_screenshot(self, filename):        """截图"""        self.driver.save_screenshot(f"screenshots/{filename}")

pytest + selenium实战项目

实战项目:电商网站测试

让我们以一个电商网站为例,构建完整的自动化测试项目。

配置文件设置

# utils/config.pyclass Config:    """测试配置类"""    BASE_URL = "https://example-shop.com"    TIMEOUT = 10    BROWSER = "chrome"    HEADLESS = False    # 测试账户信息    TEST_USER = {        "email""test@example.com",        "password""password123"    }    # 测试数据    TEST_PRODUCT = {        "name""iPhone 14",        "price""999.99"    }

基础页面类

# pages/base_page.pyfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.support import expected_conditions as ECfrom selenium.webdriver.common.by import Byclass BasePage:    """基础页面类"""    def __init__(self, driver):        self.driver = driver        self.wait = WebDriverWait(driver, 10)    def open(self, url):        """打开页面"""        self.driver.get(url)    def find_element(self, locator):        """查找元素"""        return self.wait.until(EC.presence_of_element_located(locator))    def click(self, locator):        """点击元素"""        element = self.wait.until(EC.element_to_be_clickable(locator))        element.click()    def input_text(self, locator, text):        """输入文本"""        element = self.find_element(locator)        element.clear()        element.send_keys(text)    def get_text(self, locator):        """获取元素文本"""        element = self.find_element(locator)        return element.text    def is_element_visible(self, locator):        """检查元素是否可见"""        try:            self.wait.until(EC.visibility_of_element_located(locator))            return True        except:            return False

登录页面类

# pages/login_page.pyfrom selenium.webdriver.common.by import Byfrom pages.base_page import BasePageclass LoginPage(BasePage):    """登录页面"""    # 页面元素定位    EMAIL_INPUT = (By.ID, "email")    PASSWORD_INPUT = (By.ID, "password")    LOGIN_BUTTON = (By.XPATH, "//button[@type='submit']")    ERROR_MESSAGE = (By.CLASS_NAME, "error-message")    SUCCESS_MESSAGE = (By.CLASS_NAME, "success-message")    def login(self, email, password):        """执行登录操作"""        self.input_text(self.EMAIL_INPUT, email)        self.input_text(self.PASSWORD_INPUT, password)        self.click(self.LOGIN_BUTTON)    def get_error_message(self):        """获取错误信息"""        if self.is_element_visible(self.ERROR_MESSAGE):            return self.get_text(self.ERROR_MESSAGE)        return None    def is_login_successful(self):        """检查登录是否成功"""        return self.is_element_visible(self.SUCCESS_MESSAGE)

登录测试用例

# tests/test_login.pyimport pytestfrom pages.login_page import LoginPagefrom utils.config import Configclass TestLogin:    """登录功能测试类"""    @pytest.fixture(autouse=True)    def setup(self, driver):        """测试前置条件"""        self.driver = driver        self.login_page = LoginPage(driver)        self.login_page.open(f"{Config.BASE_URL}/login")    def test_valid_login(self):        """测试有效登录"""        self.login_page.login(            Config.TEST_USER["email"],            Config.TEST_USER["password"]        )        assert self.login_page.is_login_successful()    @pytest.mark.parametrize("email,password,expected_error", [        ("""password123""邮箱不能为空"),        ("invalid-email""password123""邮箱格式不正确"),        ("test@example.com""""密码不能为空"),        ("wrong@example.com""wrongpass""用户名或密码错误")    ])    def test_invalid_login(self, email, password, expected_error):        """测试无效登录"""        self.login_page.login(email, password)        error_message = self.login_page.get_error_message()        assert expected_error in error_message    def test_login_form_elements(self):        """测试登录表单元素存在性"""        assert self.login_page.is_element_visible(self.login_page.EMAIL_INPUT)        assert self.login_page.is_element_visible(self.login_page.PASSWORD_INPUT)        assert self.login_page.is_element_visible(self.login_page.LOGIN_BUTTON)

商品搜索测试

# pages/search_page.pyfrom selenium.webdriver.common.by import Byfrom pages.base_page import BasePageclass SearchPage(BasePage):    """搜索页面"""    SEARCH_INPUT = (By.NAME, "search")    SEARCH_BUTTON = (By.CLASS_NAME, "search-btn")    SEARCH_RESULTS = (By.CLASS_NAME, "product-item")    NO_RESULTS_MESSAGE = (By.CLASS_NAME, "no-results")    PRODUCT_TITLE = (By.CLASS_NAME, "product-title")    def search_product(self, keyword):        """搜索商品"""        self.input_text(self.SEARCH_INPUT, keyword)        self.click(self.SEARCH_BUTTON)    def get_search_results_count(self):        """获取搜索结果数量"""        results = self.driver.find_elements(*self.SEARCH_RESULTS)        return len(results)    def get_first_product_title(self):        """获取第一个商品标题"""        return self.get_text(self.PRODUCT_TITLE)# tests/test_search.pyimport pytestfrom pages.search_page import SearchPagefrom utils.config import Configclass TestSearch:    """搜索功能测试类"""    @pytest.fixture(autouse=True)    def setup(self, driver):        self.driver = driver        self.search_page = SearchPage(driver)        self.search_page.open(Config.BASE_URL)    def test_valid_search(self):        """测试有效搜索"""        self.search_page.search_product("iPhone")        assert self.search_page.get_search_results_count() > 0    def test_search_no_results(self):        """测试无结果搜索"""        self.search_page.search_product("不存在的商品")        assert self.search_page.is_element_visible(self.search_page.NO_RESULTS_MESSAGE)    @pytest.mark.parametrize("keyword", [        "iPhone""Samsung""小米""华为"    ])    def test_multiple_searches(self, keyword):        """测试多个关键词搜索"""        self.search_page.search_product(keyword)        results_count = self.search_page.get_search_results_count()        assert results_count >= 0  # 至少返回0个结果

页面对象模式(POM)

页面对象模式是自动化测试中的重要设计模式,它将页面元素和操作封装在独立的类中。

完整的POM实现

# pages/product_page.pyfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.support.ui import Selectfrom pages.base_page import BasePageclass ProductPage(BasePage):    """商品详情页"""    # 商品信息元素    PRODUCT_TITLE = (By.H1, "product-title")    PRODUCT_PRICE = (By.CLASS_NAME, "price")    PRODUCT_DESCRIPTION = (By.CLASS_NAME, "description")    # 购买相关元素    QUANTITY_SELECT = (By.NAME, "quantity")    ADD_TO_CART_BUTTON = (By.ID, "add-to-cart")    CART_SUCCESS_MESSAGE = (By.CLASS_NAME, "cart-success")    # 评论相关元素    REVIEWS_SECTION = (By.ID, "reviews")    REVIEW_INPUT = (By.NAME, "review")    SUBMIT_REVIEW_BUTTON = (By.ID, "submit-review")    def get_product_info(self):        """获取商品信息"""        return {            "title"self.get_text(self.PRODUCT_TITLE),            "price"self.get_text(self.PRODUCT_PRICE),            "description"self.get_text(self.PRODUCT_DESCRIPTION)        }    def add_to_cart(self, quantity=1):        """添加到购物车"""        # 选择数量        quantity_select = Select(self.find_element(self.QUANTITY_SELECT))        quantity_select.select_by_value(str(quantity))        # 点击添加到购物车        self.click(self.ADD_TO_CART_BUTTON)        # 等待成功消息        return self.is_element_visible(self.CART_SUCCESS_MESSAGE)    def submit_review(self, review_text):        """提交评论"""        self.input_text(self.REVIEW_INPUT, review_text)        self.click(self.SUBMIT_REVIEW_BUTTON)

购物车页面测试

# tests/test_cart.pyimport pytestfrom pages.product_page import ProductPagefrom pages.cart_page import CartPagefrom utils.config import Configclass TestShoppingCart:    """购物车功能测试"""    @pytest.fixture(autouse=True)    def setup(self, driver):        self.driver = driver        self.product_page = ProductPage(driver)        self.cart_page = CartPage(driver)    def test_add_single_product_to_cart(self):        """测试添加单个商品到购物车"""        # 打开商品页面        self.product_page.open(f"{Config.BASE_URL}/product/1")        # 添加到购物车        success = self.product_page.add_to_cart(quantity=1)        assert success        # 验证购物车        self.cart_page.open(f"{Config.BASE_URL}/cart")        assert self.cart_page.get_cart_items_count() == 1    def test_add_multiple_quantities(self):        """测试添加多数量商品"""        self.product_page.open(f"{Config.BASE_URL}/product/1")        success = self.product_page.add_to_cart(quantity=3)        assert success        self.cart_page.open(f"{Config.BASE_URL}/cart")        total_quantity = self.cart_page.get_total_quantity()        assert total_quantity == 3    def test_cart_total_calculation(self):        """测试购物车总价计算"""        # 添加多个商品        products = [            {"id"1"quantity"2"price"99.99},            {"id"2"quantity"1"price"149.99}        ]        expected_total = 0        for product in products:            self.product_page.open(f"{Config.BASE_URL}/product/{product['id']}")            self.product_page.add_to_cart(product["quantity"])            expected_total += product["price"] * product["quantity"]        self.cart_page.open(f"{Config.BASE_URL}/cart")        actual_total = self.cart_page.get_total_price()        assert actual_total == expected_total

测试报告生成

HTML报告配置

# pytest.ini[tool:pytest]minversion = 6.0addopts = -v --strict-markers --html=reports/report.html --self-contained-htmltestpaths = testspython_files = test_*.pypython_classes = Test*python_functions = test_*markers =    smoke: 冒烟测试    regression: 回归测试    slow: 慢速测试

Allure报告集成

# conftest.py 添加allure配置import allureimport pytestfrom selenium import webdriver@pytest.hookimpl(tryfirst=True, hookwrapper=True)def pytest_runtest_makereport(item, call):    """生成测试报告钩子"""    outcome = yield    report = outcome.get_result()    if report.when == "call" and report.failed:        # 测试失败时自动截图        driver = item.funcargs.get('driver')        if driver:            allure.attach(                driver.get_screenshot_as_png(),                name="失败截图",                attachment_type=allure.attachment_type.PNG            )# 在测试中使用allure装饰器import allureclass TestLoginWithAllure:    """带Allure报告的登录测试"""    @allure.epic("用户管理")    @allure.feature("用户登录")    @allure.story("正常登录流程")    @allure.severity(allure.severity_level.CRITICAL)    def test_valid_login_with_allure(self, driver):        """测试有效登录 - Allure版本"""        with allure.step("打开登录页面"):            login_page = LoginPage(driver)            login_page.open(f"{Config.BASE_URL}/login")        with allure.step("输入登录凭证"):            login_page.login(                Config.TEST_USER["email"],                Config.TEST_USER["password"]            )        with allure.step("验证登录结果"):            assert login_page.is_login_successful()            allure.attach(                driver.get_screenshot_as_png(),                name="登录成功截图",                attachment_type=allure.attachment_type.PNG            )

持续集成配置

GitHub Actions配置

# .github/workflows/test.ymlname: 自动化测试on:  push:    branches: [ main, develop ]  pull_request:    branches: [ main ]jobs:  test:    runs-on: ubuntu-latest    steps:    - uses: actions/checkout@v3    - name: 设置Python环境      uses: actions/setup-python@v3      with:        python-version: '3.9'    - name: 安装Chrome      uses: browser-actions/setup-chrome@latest    - name: 安装依赖      run: |        python -m pip install --upgrade pip        pip install -r requirements.txt    - name: 运行测试      run: |        pytest tests/ --html=reports/report.html --alluredir=allure-results    - name: 生成Allure报告      uses: simple-elf/allure-report-action@master      if: always()      with:        allure_results: allure-results        allure_history: allure-history    - name: 上传测试报告      uses: actions/upload-artifact@v3      if: always()      with:        name: test-reports        path: |          reports/          allure-report/

Docker配置

# DockerfileFROM python:3.9-slim# 安装系统依赖RUN apt-get update && apt-get install -y \    wget \    gnupg \    unzip \    curl# 安装ChromeRUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \    && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \    && apt-get update \    && apt-get install -y google-chrome-stable# 设置工作目录WORKDIR /app# 复制项目文件COPY requirements.txt .RUN pip install -r requirements.txtCOPY . .# 运行测试CMD ["pytest", "tests/", "--html=reports/report.html"]

最佳实践和进阶技巧

测试数据管理

# utils/test_data.pyimport jsonimport yamlfrom pathlib import Pathclass TestDataManager:    """测试数据管理器"""    def __init__(self, data_dir="test_data"):        self.data_dir = Path(data_dir)    def load_json_data(self, filename):        """加载JSON测试数据"""        file_path = self.data_dir / f"{filename}.json"        with open(file_path, 'r', encoding='utf-8'as f:            return json.load(f)    def load_yaml_data(self, filename):        """加载YAML测试数据"""        file_path = self.data_dir / f"{filename}.yaml"        with open(file_path, 'r', encoding='utf-8'as f:            return yaml.safe_load(f)# test_data/login_data.yamlvalid_users:  - email: "user1@example.com"    password: "password123"    expected_result: "success"  - email: "user2@example.com"    password: "password456"    expected_result: "success"invalid_users:  - email: ""    password: "password123"    expected_error: "邮箱不能为空"  - email: "invalid-email"    password: "password123"    expected_error: "邮箱格式不正确"

失败重试机制

# conftest.pyimport pytest@pytest.fixture(autouse=True)def retry_failed_tests(request):    """失败测试重试机制"""    if request.node.rep_call.failed:        # 重试逻辑        pass# 使用pytest-rerunfailures插件# pip install pytest-rerunfailures# pytest --reruns 3 --reruns-delay 2

并行测试执行

# 安装pytest-xdist# pip install pytest-xdist# 并行执行测试# pytest -n auto  # 自动检测CPU核心数# pytest -n 4     # 使用4个进程

测试环境管理

# utils/environment.pyimport osfrom enum import Enumclass Environment(Enum):    DEV = "dev"    TEST = "test"    STAGING = "staging"    PROD = "prod"class EnvironmentConfig:    """环境配置管理"""    def __init__(self):        self.current_env = Environment(os.getenv('TEST_ENV''test'))    def get_base_url(self):        """获取当前环境的基础URL"""        urls = {            Environment.DEV: "http://dev.example.com",            Environment.TEST: "http://test.example.com",            Environment.STAGING: "http://staging.example.com",            Environment.PROD: "http://example.com"        }        return urls[self.current_env]    def get_database_config(self):        """获取数据库配置"""        configs = {            Environment.TEST: {                "host""test-db.example.com",                "database""test_db"            },            Environment.STAGING: {                "host""staging-db.example.com",                "database""staging_db"            }        }        return configs.get(self.current_env, {})

性能测试集成

# tests/test_performance.pyimport timeimport pytestfrom selenium.webdriver.support.ui import WebDriverWaitclass TestPerformance:    """性能测试"""    def test_page_load_time(self, driver):        """测试页面加载时间"""        start_time = time.time()        driver.get("https://example.com")        WebDriverWait(driver, 10).until(            lambda d: d.execute_script("return document.readyState") == "complete"        )        load_time = time.time() - start_time        assert load_time < 5.0f"页面加载时间过长: {load_time}秒"    def test_search_response_time(self, driver, search_page):        """测试搜索响应时间"""        search_page.open("https://example.com")        start_time = time.time()        search_page.search_product("iPhone")        # 等待搜索结果出现        WebDriverWait(driver, 10).until(            lambda d: len(d.find_elements(*search_page.SEARCH_RESULTS)) > 0        )        response_time = time.time() - start_time        assert response_time < 3.0f"搜索响应时间过长: {response_time}秒"

数据库验证

# utils/database.pyimport sqlite3import pymongofrom contextlib import contextmanagerclass DatabaseHelper:    """数据库操作助手"""    def __init__(self, db_config):        self.config = db_config    @contextmanager    def get_connection(self):        """获取数据库连接"""        if self.config['type'] == 'sqlite':            conn = sqlite3.connect(self.config['path'])        elif self.config['type'] == 'mysql':            import mysql.connector            conn = mysql.connector.connect(**self.config)        try:            yield conn        finally:            conn.close()    def verify_user_created(self, email):        """验证用户是否创建成功"""        with self.get_connection() as conn:            cursor = conn.cursor()            cursor.execute("SELECT * FROM users WHERE email = ?", (email,))            result = cursor.fetchone()            return result is not None# 在测试中使用数据库验证def test_user_registration_with_db_verification(driver, db_helper):    """测试用户注册并验证数据库"""    # 执行注册操作    registration_page = RegistrationPage(driver)    test_email = f"test_{int(time.time())}@example.com"    registration_page.register_user(        email=test_email,        password="password123"    )    # 验证UI显示成功    assert registration_page.is_registration_successful()    # 验证数据库中确实创建了用户    assert db_helper.verify_user_created(test_email)

总结

本教程全面介绍了使用pytest和selenium进行Python自动化测试的完整流程,从环境搭建到高级技巧,涵盖了实际项目中的各个方面。

关键要点回顾

  • 环境搭建
    : 正确配置Python环境、浏览器驱动和项目结构
  • pytest框架
    : 掌握基础测试、fixture机制和参数化测试
  • selenium操作
    : 学会元素定位、常用操作和等待机制
  • 页面对象模式
    : 使用POM提高代码复用性和维护性
  • 测试报告
    : 生成专业的HTML和Allure测试报告
  • 持续集成
    : 配置CI/CD流程实现自动化测试
  • 最佳实践
    : 应用进阶技巧提升测试质量和效率

以上就是Python利用pytest和selenium实现自动化测试完整指南的详细内容

您可能感兴趣的文章:

Python使用pytest高效编写和管理单元测试的完整指南

pytest测试框架+allure超详细教程

Python使用pytest-playwright的原因分析

python playwright--pytest-playwright、pytest-base-url插件编写用例

使用pytest结合Playwright实现页面元素在两个区域间拖拽功能

使用Playwright+Pytest构建Web UI自动化测试框架完整示例

Python中的自动化测试与质量保障详解

Python pytest 框架通关指南:自动化测试不再难

Java环境搭建Selenium代码自动化测试框架

Fiddler如何抓取手机APP数据包

fiddler抓包小技巧之自动保存抓包数据的实现方法分析【可根据需求过滤】

软件测试之使用Fiddler实现弱网测试

python软件测试Jmeter性能测试JDBC Request(结合数据库)的使用详解

Python+request+unittest实现接口测试框架集成实例

po+selenium+unittest自动化测试项目实战

软件测试中的移动端的埋点测试(干货)

测试入门以及pytest入门

python ui自动化测试

Python测试框架之pytest详解

使用postman传递list集合后台springmvc接收

基于postman实现http接口测试过程解析

pytest fixtures装饰器的使用和如何控制用例的执行顺序

Python测试框架:pytest学习笔记

python单元测试框架pytest的使用示例

Pytest单元测试框架如何实现参数化

今天也要点一键哦❤️❤️

  "赞"、"在看"、

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-08-22 01:58:14 HTTP/2.0 GET : https://f.mffb.com.cn/a/505044.html
  2. 运行时间 : 0.195314s [ 吞吐率:5.12req/s ] 内存消耗:4,727.22kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=761ae0357b1081055d04f25109875873
  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.001339s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000617s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000572s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001172s ]
  6. SELECT * FROM `set` [ RunTime:0.000483s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001256s ]
  8. SELECT * FROM `article` WHERE `id` = 505044 LIMIT 1 [ RunTime:0.001179s ]
  9. UPDATE `article` SET `lasttime` = 1787335094 WHERE `id` = 505044 [ RunTime:0.008547s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000600s ]
  11. SELECT * FROM `article` WHERE `id` < 505044 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.001076s ]
  12. SELECT * FROM `article` WHERE `id` > 505044 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000917s ]
  13. SELECT * FROM `article` WHERE `id` < 505044 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.003177s ]
  14. SELECT * FROM `article` WHERE `id` < 505044 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.019370s ]
  15. SELECT * FROM `article` WHERE `id` < 505044 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.002907s ]
0.198445s