当前位置:首页>python>Python操作MySQL数据库:网络安全视角下的增删改查全攻略

Python操作MySQL数据库:网络安全视角下的增删改查全攻略

  • 2026-04-20 04:23:36
Python操作MySQL数据库:网络安全视角下的增删改查全攻略

在网络安全领域,数据库作为核心数据存储设施,其操作安全性直接关系到系统整体安全。

一、数据库操作安全基础

1.1 连接安全配置

import pymysqlfrom pymysql.cursors import DictCursor# 安全连接配置示例defget_secure_connection():try:        conn = pymysql.connect(            host='127.0.0.1',       # 避免使用默认localhost            user='app_user',         # 最小权限原则专用账户            password='ComplexPwd@123'# 符合密码策略要求            database='secure_db',            port=3306,            charset='utf8mb4',            ssl={'ca''/path/to/ca.pem'},  # 启用SSL加密            cursorclass=DictCursor,            connect_timeout=10# 连接超时设置        )return connexcept pymysql.Error as e:print(f"Connection failed: {e}")returnNone

安全要点

  • • 使用专用数据库账户而非root
  • • 启用SSL加密传输
  • • 设置合理的连接超时
  • • 避免硬编码凭证(建议使用环境变量或密钥管理服务)

1.2 参数化查询防御SQL注入

defsafe_query(conn, user_id):try:with conn.cursor() as cursor:# 使用参数化查询而非字符串拼接            sql = "SELECT * FROM users WHERE id = %s AND status = %s"            cursor.execute(sql, (user_id, 'active'))            result = cursor.fetchall()return resultexcept pymysql.Error as e:print(f"Query error: {e}")returnNone

防御机制

  • • 自动转义特殊字符
  • • 预编译SQL语句
  • • 分离数据与代码

二、安全增删改查实现

2.1 安全插入操作(CREATE)

definsert_user_safely(conn, user_data):"""    安全插入用户数据    :param conn: 数据库连接    :param user_data: 字典格式用户数据    :return: 操作结果    """try:with conn.cursor() as cursor:# 数据验证ifnotall(k in user_data for k in ['username''email''password']):raise ValueError("Missing required fields")# 密码哈希处理(实际应使用bcrypt等专用库)            hashed_pwd = user_data['password'].encode('utf-8').hex()            sql = """            INSERT INTO users             (username, email, password_hash, created_at)             VALUES (%s, %s, %s, NOW())            """            cursor.execute(sql, (                user_data['username'],                user_data['email'],                hashed_pwd            ))            conn.commit()return cursor.rowcountexcept pymysql.Error as e:        conn.rollback()print(f"Insert failed: {e}")return0

安全增强

  • • 输入数据完整性验证
  • • 敏感数据加密存储
  • • 事务回滚机制
  • • 操作日志记录

2.2 安全查询操作(READ)

defget_user_with_rbac(conn, user_id, requesting_user):"""    基于RBAC的权限控制查询    :param conn: 数据库连接    :param user_id: 目标用户ID    :param requesting_user: 请求用户信息    :return: 查询结果或None    """try:with conn.cursor() as cursor:# 权限检查(示例简化版)if requesting_user['role'] != 'admin'and requesting_user['id'] != user_id:raise PermissionError("Unauthorized access")            sql = """            SELECT id, username, email, created_at             FROM users             WHERE id = %s AND status = 'active'            """            cursor.execute(sql, (user_id,))            result = cursor.fetchone()# 数据脱敏处理if result:                result['email'] = mask_email(result['email'])return resultexcept pymysql.Error as e:print(f"Query error: {e}")returnNonedefmask_email(email):"""简单邮箱脱敏函数"""    parts = email.split('@')iflen(parts[0]) > 3:returnf"{parts[0][0]}***@{parts[1]}"return email

安全措施

  • • 基于角色的访问控制(RBAC)
  • • 最小权限数据返回
  • • 敏感数据脱敏处理
  • • 查询条件白名单验证

2.3 安全更新操作(UPDATE)

defupdate_user_password(conn, user_id, new_password, current_user):"""    安全密码更新(需验证当前密码)    """try:with conn.cursor() as cursor:# 权限验证if current_user['role'] != 'admin'and current_user['id'] != user_id:raise PermissionError("Password change requires ownership or admin rights")# 获取存储的密码哈希(实际应从数据库获取)            stored_hash = get_stored_password_hash(conn, user_id)# 验证当前密码(非admin用户需要)if current_user['role'] != 'admin':# 这里应使用专用密码验证函数ifnot verify_password(current_user['password'], stored_hash):raise ValueError("Current password incorrect")# 生成新密码哈希            new_hash = new_password.encode('utf-8').hex()  # 实际应使用bcrypt            sql = """            UPDATE users             SET password_hash = %s,                 password_updated_at = NOW()            WHERE id = %s AND status = 'active'            """            cursor.execute(sql, (new_hash, user_id))if cursor.rowcount == 0:raise ValueError("User not found or inactive")            conn.commit()returnTrueexcept pymysql.Error as e:        conn.rollback()print(f"Update failed: {e}")returnFalse

安全关键点

  • • 操作前权限验证
  • • 密码复杂度检查
  • • 密码更新历史记录
  • • 操作审计日志

2.4 安全删除操作(DELETE)

defsoft_delete_user(conn, user_id, operator):"""    安全软删除实现(推荐替代物理删除)    """try:with conn.cursor() as cursor:# 权限验证if operator['role'] != 'admin':raise PermissionError("Only admins can delete users")# 先检查用户是否存在            cursor.execute("SELECT id FROM users WHERE id = %s", (user_id,))ifnot cursor.fetchone():raise ValueError("User not found")# 执行软删除            sql = """            UPDATE users             SET status = 'deleted',                 deleted_at = NOW(),                deleted_by = %s            WHERE id = %s            """            cursor.execute(sql, (operator['id'], user_id))if cursor.rowcount == 0:raise ValueError("No rows affected")            conn.commit()# 记录删除审计日志            log_deletion(conn, user_id, operator)returnTrueexcept pymysql.Error as e:        conn.rollback()print(f"Delete failed: {e}")returnFalsedeflog_deletion(conn, user_id, operator):"""记录删除操作的审计日志"""try:with conn.cursor() as cursor:            sql = """            INSERT INTO audit_logs             (action, target_id, operator_id, action_time, ip_address)            VALUES (%s, %s, %s, NOW(), %s)            """# 实际应从请求获取IP            cursor.execute(sql, ('user_delete', user_id, operator['id'], '127.0.0.1'))            conn.commit()except pymysql.Error:        conn.rollback()

安全最佳实践

  • • 优先使用软删除而非物理删除
  • • 严格的权限控制
  • • 操作审计日志记录
  • • 删除前数据验证

三、高级安全防护措施

3.1 连接池安全管理

from dbutils.pooled_db import PooledDBclassSecureConnectionPool:    _pool = None    @classmethoddefget_pool(cls):ifnot cls._pool:            cls._pool = PooledDB(                creator=pymysql,                mincached=2,                maxcached=5,                maxconnections=10,                host='127.0.0.1',                user='app_user',                password='ComplexPwd@123',                database='secure_db',                charset='utf8mb4',                cursorclass=DictCursor,# 连接池安全配置                setsession=['SET AUTOCOMMIT = 1'],  # 避免长事务                ping=4# 每4次检查连接有效性            )return cls._pool    @classmethoddefget_connection(cls):return cls.get_pool().connection()

优势

  • • 避免频繁创建销毁连接
  • • 连接有效性检查
  • • 资源使用限制

3.2 动态数据脱敏

defdynamic_data_masking(cursor, user_role):"""    根据用户角色动态脱敏查询结果    """classMaskingCursor(cursor.__class__):deffetchone(self):            row = super().fetchone()return _apply_masking(row, user_role) if row elseNonedeffetchall(self):            rows = super().fetchall()return [_apply_masking(row, user_role) for row in rows]return MaskingCursor(cursor._cursor)def_apply_masking(row, role):ifnot row:returnNone    masked_row = row.copy()if'ssn'in masked_row and role != 'admin':        masked_row['ssn'] = '***-**-' + masked_row['ssn'][-4:]if'email'in masked_row and role != 'self':        masked_row['email'] = mask_email(masked_row['email'])return masked_row

3.3 操作频率限制

from functools import wrapsimport timefrom collections import defaultdictclassRateLimiter:def__init__(self, max_calls=5, period=60):self.max_calls = max_callsself.period = periodself.call_logs = defaultdict(list)def__call__(self, func):        @wraps(func)defwrapper(*args, **kwargs):# 获取调用者标识(实际应从认证信息获取)            caller_id = kwargs.get('user_id''anonymous')            now = time.time()# 清理过期记录self.call_logs[caller_id] = [                t for t inself.call_logs[caller_id] if now - t < self.period            ]iflen(self.call_logs[caller_id]) >= self.max_calls:raise RateLimitExceeded("Too many requests")self.call_logs[caller_id].append(now)return func(*args, **kwargs)return wrapper# 使用示例@RateLimiter(max_calls=10, period=60)defsensitive_db_operation(conn, user_id):# 数据库操作pass

四、完整安全操作流程示例

import pymysqlfrom pymysql.cursors import DictCursorfrom functools import wrapsimport hashlibimport time# 安全装饰器:操作审计日志defaudit_log(func):    @wraps(func)defwrapper(conn, user_id, *args, **kwargs):        start_time = time.time()try:            result = func(conn, user_id, *args, **kwargs)# 记录成功操作with conn.cursor() as cursor:                cursor.execute("""                INSERT INTO audit_logs                 (action, target_id, operator_id, action_time, duration, status)                VALUES (%s, %s, %s, NOW(), %s, 'success')                """, (                    func.__name__,                    user_id,                    kwargs.get('operator_id'0),  # 实际应从认证信息获取                    time.time() - start_time                ))                conn.commit()return resultexcept Exception as e:# 记录失败操作with conn.cursor() as cursor:                cursor.execute("""                INSERT INTO audit_logs                 (action, target_id, operator_id, action_time, duration, status, error)                VALUES (%s, %s, %s, NOW(), %s, 'failed', %s)                """, (                    func.__name__,                    user_id,                    kwargs.get('operator_id'0),                    time.time() - start_time,str(e)[:255]  # 截断错误信息                ))                conn.commit()raise# 重新抛出异常return wrapper# 安全密码哈希函数(实际应使用bcrypt)defhash_password(password):return hashlib.sha256(password.encode('utf-8')).hexdigest()classSecureDBOperations:def__init__(self, conn):self.conn = conn    @audit_logdefcreate_user(self, user_data, operator_id):"""安全创建用户"""try:withself.conn.cursor() as cursor:# 参数验证ifnotall(k in user_data for k in ['username''password''email']):raise ValueError("Missing required fields")# 检查用户名是否已存在                cursor.execute("""                SELECT id FROM users WHERE username = %s OR email = %s                """, (user_data['username'], user_data['email']))if cursor.fetchone():raise ValueError("Username or email already exists")# 密码哈希处理                hashed_pwd = hash_password(user_data['password'])# 插入用户                cursor.execute("""                INSERT INTO users                 (username, email, password_hash, created_by, created_at)                VALUES (%s, %s, %s, %s, NOW())                """, (                    user_data['username'],                    user_data['email'],                    hashed_pwd,                    operator_id                ))self.conn.commit()return cursor.lastrowidexcept pymysql.Error as e:self.conn.rollback()raise    @audit_logdefget_user_details(self, user_id, requesting_user):"""安全获取用户详情"""try:withself.conn.cursor(DictCursor) as cursor:# RBAC检查if requesting_user['role'] != 'admin'and requesting_user['id'] != user_id:raise PermissionError("Unauthorized access")                cursor.execute("""                SELECT id, username, email, created_at                 FROM users                 WHERE id = %s AND status = 'active'                """, (user_id,))                user = cursor.fetchone()ifnot user:raise ValueError("User not found")# 数据脱敏if requesting_user['role'] != 'admin':                    user['email'] = self._mask_email(user['email'])return userexcept pymysql.Error as e:raisedef_mask_email(self, email):"""简单邮箱脱敏"""        parts = email.split('@')iflen(parts[0]) > 3:returnf"{parts[0][0]}***@{parts[1]}"return email    @audit_logdefupdate_user_email(self, user_id, new_email, operator):"""安全更新用户邮箱"""try:withself.conn.cursor() as cursor:# 权限验证if operator['role'] != 'admin'and operator['id'] != user_id:raise PermissionError("Unauthorized email update")# 验证新邮箱格式if'@'notin new_email or'.'notin new_email.split('@')[-1]:raise ValueError("Invalid email format")# 检查邮箱是否已被使用                cursor.execute("""                SELECT id FROM users WHERE email = %s AND id != %s                """, (new_email, user_id))if cursor.fetchone():raise ValueError("Email already in use")# 更新邮箱                cursor.execute("""                UPDATE users                 SET email = %s, updated_at = NOW(), updated_by = %s                WHERE id = %s AND status = 'active'                """, (new_email, operator['id'], user_id))if cursor.rowcount == 0:raise ValueError("User not found or inactive")self.conn.commit()returnTrueexcept pymysql.Error as e:self.conn.rollback()raise# 使用示例if __name__ == "__main__":try:# 建立安全连接        conn = pymysql.connect(            host='127.0.0.1',            user='app_user',            password='ComplexPwd@123',            database='secure_db',            charset='utf8mb4',            cursorclass=DictCursor        )# 初始化安全操作类        db_ops = SecureDBOperations(conn)# 模拟操作员        operator = {'id'1'role''admin'}# 创建用户        user_id = db_ops.create_user({'username''testuser','password''SecurePass123!','email''test@example.com'        }, operator['id'])print(f"Created user with ID: {user_id}")# 查询用户(admin权限)        user_data = db_ops.get_user_details(user_id, operator)print(f"User details: {user_data}")# 更新邮箱(admin权限)        db_ops.update_user_email(user_id, 'new.email@example.com', operator)print("Email updated successfully")except Exception as e:print(f"Operation failed: {e}")finally:if'conn'inlocals():            conn.close()

五、关键安全建议

  1. 1. 连接安全
    • • 使用专用数据库账户
    • • 启用SSL加密传输
    • • 实施连接池管理
    • • 设置合理的连接超时
  2. 2. 查询安全
    • • 始终使用参数化查询
    • • 实施基于角色的访问控制(RBAC)
    • • 对返回数据进行脱敏处理
    • • 限制查询结果集大小
  3. 3. 数据安全
    • • 敏感数据加密存储
    • • 实施动态数据脱敏
    • • 密码使用专用哈希算法(bcrypt/Argon2)
    • • 避免在日志中记录敏感信息
  4. 4. 操作安全
    • • 优先使用软删除
    • • 实施操作频率限制
    • • 记录完整审计日志
    • • 所有修改操作需验证当前状态
  5. 5. 异常处理
    • • 避免在错误信息中暴露系统细节
    • • 实施适当的异常转换
    • • 确保资源在异常情况下正确释放

通过实施这些安全措施,开发者可以显著降低Python操作MySQL数据库时的安全风险,构建更加健壮的安全防护体系。在实际应用中,应根据具体业务需求和安全合规要求,对这些措施进行适当调整和增强。

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-04-20 06:02:24 HTTP/2.0 GET : https://f.mffb.com.cn/a/484933.html
  2. 运行时间 : 0.128995s [ 吞吐率:7.75req/s ] 内存消耗:4,978.39kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=ea8efc72c2ba24e11fd4bedcf5ad1ec7
  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.000631s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000849s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000282s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000781s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000522s ]
  6. SELECT * FROM `set` [ RunTime:0.000202s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000629s ]
  8. SELECT * FROM `article` WHERE `id` = 484933 LIMIT 1 [ RunTime:0.003145s ]
  9. UPDATE `article` SET `lasttime` = 1776636144 WHERE `id` = 484933 [ RunTime:0.005166s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000300s ]
  11. SELECT * FROM `article` WHERE `id` < 484933 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.003969s ]
  12. SELECT * FROM `article` WHERE `id` > 484933 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.001741s ]
  13. SELECT * FROM `article` WHERE `id` < 484933 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.006959s ]
  14. SELECT * FROM `article` WHERE `id` < 484933 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.001300s ]
  15. SELECT * FROM `article` WHERE `id` < 484933 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.031110s ]
0.131367s