当前位置:首页>python>为什么你的Python总报错?80%是这几个习惯导致的

为什么你的Python总报错?80%是这几个习惯导致的

  • 2026-07-02 09:58:11
为什么你的Python总报错?80%是这几个习惯导致的

上周排查bug,一个简单的数据处理脚本,居然有5个不同的错误。看着满屏的报错信息,我突然意识到:很多Python错误,其实不是技术问题,而是习惯问题

今天就来盘点那些导致Python频繁报错的坏习惯,以及如何改正它们。相信我,改掉这些习惯,你的代码报错率至少能降低80%。

往期阅读>>>

Python 20 个文本分析的库:效率提升 10 倍的秘密武器

Python 金融定价利器FinancePy库深度解析

Python 适合新手的量化分析框架AKQuant解析
Python 25个数据清洗技巧:让你的数据质量提升10倍

Python 为什么会成为AI时代的头部语言

Python 40个常用的列表推导式

Python 50个提高代码开发效率的方法

Python 自动检测服务HTTPS证书过期时间并发送预警

Python 自动化操作Redis的15个实用脚本

Python 自动化管理Jenkins的15个实用脚本,提升效率

Python copyparty搭建轻量的文件服务器的方法

Python 实现2FA认证的方法,提升安全性

Python 封装20个常用API接口,提升开发效率

App2Docker:如何无需编写Dockerfile也可以创建容器镜像

Python 集成 Nacos 配置中心的方法

Python 35个JSON数据处理方法

Python 字典与列表的20个核心技巧

Python 15个文本分析的库,提升效率

Python 15个Pandas技巧,提升数据分析效率

Python 运维中30个常用的库,提升效率

Python调用远程接口的方法

Python 提取HTML文本的方法,提升效率

Python 应用容器化方法:实现“一次部署,处处运行”

Python 自动化识别Nginx配置并导出为excel文件,提升Nginx管理效率

Python 5个常见的异步任务处理框架

Python数据科学常见的30个库

Python 50个实用代码片段,优雅高效


坏习惯1:变量命名随意,自己都看不懂

错误示范:

# 这是什么意思?三个月后你还记得吗?a = 10b = 20c = a+b# c是什么?总和?平均值?x = get_data()  # x是什么数据?y = process(x)  # process做了什么?z = save(y)     # 保存到哪里?# 更糟糕的:使用内置函数名list = [123]  # 覆盖了list()函数str = "hello"# 覆盖了str()函数

导致的问题:

  1. TypeError: 'list' object is not callable(覆盖了内置函数)

  2. NameError: name 'total' is not defined(变量名记错)

  3. 代码难以理解,调试困难

正确做法:

# 使用有意义的变量名student_count = 10average_score = 85.5total_amount = calculate_total(pricequantity)# 集合类型加后缀user_list = ["张三""李四"]config_dict = {"host""localhost""port"8080}name_set = {"Alice""Bob"}# 布尔值用is_、has_开头is_valid = Truehas_permission = Falseis_connected = check_connection()# 函数名用动词开头defcalculate_average(scores):returnsum(scores/len(scores)defvalidate_email(email):return"@"inemail# 常量用大写MAX_RETRIES = 3DEFAULT_TIMEOUT = 30API_BASE_URL = "https://api.example.com"

命名规范检查:

# 安装pylint检查命名# pip install pylint# pylint your_script.py# 或者使用flake8插件# pip install flake8-naming# flake8 your_script.py

坏习惯2:不处理None,导致AttributeError

错误示范:

# API返回可能是Noneuser_data = fetch_user_data(user_id)# 直接访问属性,可能报错email = user_data["email"]  # 如果user_data是None,TypeErrorname = user_data.get("name")  # 如果user_data是None,AttributeError# 函数可能返回Noneresult = find_user_by_email(email)result.send_notification()  # 如果result是None,AttributeError

导致的问题:

  • AttributeError: 'NoneType' object has no attribute 'xxx'

  • TypeError: 'NoneType' object is not subscriptable

正确做法:

# 方法1:明确检查Noneuser_data = fetch_user_data(user_id)ifuser_dataisnotNone:email = user_data.get("email""default@example.com")name = user_data.get("name""未知用户")else:# 处理None情况email = "default@example.com"name = "未知用户"# 方法2:使用or提供默认值user_data = fetch_user_data(user_idor {}email = user_data.get("email""default@example.com")# 方法3:使用Walrus运算符(Python 3.8+)if (data := fetch_user_data(user_id)) isnotNone:process_data(data)# 方法4:使用try-excepttry:user_data = fetch_user_data(user_id)email = user_data["email"]except (TypeErrorKeyError):email = "default@example.com"# 方法5:使用Optional类型提示fromtypingimportOptionaldeffind_user(user_idstr->Optional[dict]:"""明确表示可能返回None"""# 实现...pass# 使用时IDE会提示可能为Noneuser = find_user("123")ifuser:  # IDE会提示检查Noneemail = user["email"]

None安全工具:

# 使用pydantic确保数据完整性frompydanticimportBaseModelFieldfromtypingimportOptionalclassUser(BaseModel):namestremailstrageOptional[int] = None# 明确标注可选字段# 使用后不会出现意外的Noneuser = User(name="张三"email="zhang@example.com")print(user.age)  # 输出: None,但不会报错

坏习惯3:错误使用可变默认参数

经典坑爹错误:

defadd_item(itemitems=[]):"""添加项目到列表"""items.append(item)returnitems# 看起来没问题?print(add_item(1))  # [1]print(add_item(2))  # 期望[2],实际[1, 2]!print(add_item(3))  # 期望[3],实际[1, 2, 3]!# 原因:默认参数在函数定义时只创建一次# 所有调用共享同一个列表对象

导致的问题:

  • 数据污染,不同调用之间相互影响

  • 难以发现的bug,测试时正常,生产环境异常

  • UnboundLocalError(在函数内修改后又被读取)

正确做法:

# 方法1:使用None作为默认值defadd_item(itemitems=None):ifitemsisNone:items = []  # 每次调用创建新列表items.append(item)returnitems# 方法2:使用不可变类型defcreate_user(namepermissions=()):  # 元组是不可变的return {"name"name"permissions"list(permissions)}# 方法3:使用functools.partialfromfunctoolsimportpartialdefprocess_data(dataconfig=None):ifconfigisNone:config = {}# 处理数据returnprocessed_data# 创建特定配置的版本process_with_defaults = partial(process_dataconfig={"mode""fast"})# 方法4:使用数据类fromdataclassesimportdataclassfieldfromtypingimportList@dataclassclassShoppingCart:itemsList[str] = field(default_factory=list)  # 每次创建新列表defadd_item(selfitem):self.items.append(item)

检测工具:

# 使用pylint检测# pylint会警告:Dangerous default value [] as argument# 使用flake8插件# pip install flake8-bugbear# 会检测到:B006 Do not use mutable data structures for argument defaults

坏习惯4:异常处理过于宽泛

错误示范:

# 捕获所有异常,隐藏真正问题try:result = risky_operation()save_to_database(result)send_email_notification()exceptException:  # 捕获所有异常print("出错了")  # 什么错?不知道# 捕获异常但不处理try:process_file("data.txt")except:pass# 静默失败,难以调试# 错误的异常顺序try:parse_json(data)exceptExceptionase:  # 太宽泛,放在前面print(f"错误: {e}")exceptjson.JSONDecodeError:  # 永远不会执行print("JSON解析错误")

导致的问题:

  1. 隐藏真正的bug

  2. 难以调试和定位问题

  3. 资源泄漏(文件、连接未关闭)

  4. 程序状态不一致

正确做法:

# 原则1:只捕获你能处理的异常try:config = load_config("config.yaml")exceptFileNotFoundError:# 文件不存在,使用默认配置config = get_default_config()exceptyaml.YAMLErrorase:# 配置文件格式错误,记录日志logger.error(f"配置文件格式错误: {e}")# 可以选择退出或使用默认值config = get_default_config()# 让其他异常(如内存不足)向上传播# 原则2:从具体到一般try:response = requests.get(urltimeout=10)response.raise_for_status()  # 检查HTTP状态data = response.json()exceptrequests.Timeout:logger.warning(f"请求超时: {url}")returnNoneexceptrequests.HTTPErrorase:logger.error(f"HTTP错误 {e.response.status_code}: {url}")returnNoneexceptjson.JSONDecodeError:logger.error(f"响应不是有效的JSON: {url}")returnNoneexceptExceptionase:# 最后捕获一般异常,记录详细信息logger.exception(f"未知错误: {e}")raise# 重新抛出,让上层处理# 原则3:使用else和finallytry:connection = create_database_connection()cursor = connection.cursor()exceptConnectionErrorase:logger.error(f"数据库连接失败: {e}")raiseelse:# 只有try成功时才执行try:cursor.execute("SELECT * FROM users")results = cursor.fetchall()exceptDatabaseErrorase:logger.error(f"查询失败: {e}")results = []finally:# 确保游标关闭cursor.close()finally:# 无论成功失败都执行ifconnection:connection.close()# 原则4:使用上下文管理器fromcontextlibimportsuppress# 忽略特定异常(明确知道可以忽略)withsuppress(FileNotFoundError):os.remove("temp_file.txt")# 使用with语句自动管理资源withopen("data.txt""r"asf:content = f.read()  # 文件会自动关闭

异常处理工具:

# 自定义异常类,建立异常层次classAppError(Exception):"""应用基础异常"""passclassValidationError(AppError):"""数据验证错误"""passclassDatabaseError(AppError):"""数据库错误"""def__init__(selfmessagesql=Noneparams=None):self.sql = sqlself.params = paramssuper().__init__(message)# 使用时defsave_user(user_data):ifnotvalidate_user(user_data):raiseValidationError("用户数据无效")try:db.execute("INSERT INTO users VALUES (?, ?)"                  [user_data["name"], user_data["email"]])exceptsqlite3.Errorase:raiseDatabaseError("保存用户失败"sql=sqlparams=paramsfrome

坏习惯5:不理解Python的作用域规则

常见错误:

# 错误1:在函数内修改全局变量count = 0defincrement():count += 1# UnboundLocalError: local variable 'count' referenced before assignment# 错误2:循环变量泄漏foriinrange(5):process(i)print(i)  # 输出4,i仍然存在!# 错误3:闭包变量捕获defcreate_multipliers():return [lambdaxi*xforiinrange(5)]multipliers = create_multipliers()print(multipliers[0](2))  # 期望0,实际8(i=4)print(multipliers[1](2))  # 期望2,实际8(i=4)# 错误4:类属性与实例属性混淆classUser:users = []  # 类属性def__init__(selfname):self.name = nameself.users.append(self)  # 修改的是类属性!user1 = User("张三")user2 = User("李四")print(user1.users)  # [user1, user2]print(user2.users)  # [user1, user2] 同一个列表!

正确做法:

# 解决方案1:明确声明全局变量count = 0defincrement():globalcount# 明确声明使用全局变量count += 1# 更好的方案:使用返回值defincrement_counter(current):returncurrent+1count = increment_counter(count)# 解决方案2:避免循环变量泄漏foriinrange(5):process(i)# i在这里不可访问(Python 3中,for循环变量作用域仅限于循环内)# 或者使用列表推导式results = [process(iforiinrange(5)]# 解决方案3:闭包变量立即绑定defcreate_multipliers():return [lambdaxi=ii*xforiinrange(5)]  # 使用默认参数立即绑定# 或者使用partialfromfunctoolsimportpartialdefcreate_multipliers():return [partial(lambdaixi*xiforiinrange(5)]# 解决方案4:正确使用类属性和实例属性classUser:all_users = []  # 类属性,所有实例共享def__init__(selfname):self.name = name# 实例属性,每个实例独立self.friends = []  # 实例属性User.all_users.append(self)  # 修改类属性要指定类名@classmethoddefget_user_count(cls):returnlen(cls.all_users)  # 使用cls访问类属性# 使用property管理属性访问classUser:def__init__(selfname):self._name = name# 私有属性@propertydefname(self):returnself._name@name.setterdefname(selfvalue):ifnotvalue:raiseValueError("姓名不能为空")self._name = value

作用域调试技巧:

# 查看局部变量和全局变量defmy_function():x = 10y = 20print(locals())  # 输出局部变量print(globals().keys())  # 输出全局变量名# 使用dis模块查看字节码importdisdeftest_scope():x = 1definner():returnx+1returninner()dis.dis(test_scope)  # 查看变量作用域

坏习惯6:忽略类型提示,运行时才发现类型错误

错误示范:

# 没有类型提示,只能运行时才发现错误defcalculate_total(pricequantity):returnprice*quantity# 调用时result = calculate_total("100"2)  # 返回"100100",不是200!result = calculate_total(100"2")  # TypeError: can't multiply sequence by non-int# 更复杂的例子defprocess_data(data):# data是什么类型?字典?列表?字符串?returndata["value"*2# 如果data是列表,KeyError!

正确做法:

# 添加类型提示fromtypingimportListDictOptionalUniondefcalculate_total(pricefloatquantityint->float:"""计算总价    Args:        price: 单价,浮点数        quantity: 数量,整数    Returns:        总价,浮点数    """returnprice*quantity# 复杂类型提示defprocess_users(usersList[Dict[strUnion[strint]]],filter_activebool = True->List[str]:"""处理用户列表    Args:        users: 用户字典列表,每个字典包含name和age        filter_active: 是否只过滤活跃用户    Returns:        用户名列表    """iffilter_active:return [user["name"foruserinusersifuser.get("active"True)]return [user["name"foruserinusers]# 使用mypy进行静态检查# pip install mypy# mypy your_script.py# 运行时类型检查(使用pydantic)frompydanticimportBaseModelvalidatorclassUser(BaseModel):namestrageintemailstr@validator('age')defvalidate_age(clsv):ifv<0:raiseValueError("年龄不能为负数")returnv# 自动验证类型user = User(name="张三"age=25email="zhang@example.com")# 如果类型错误,会在创建时立即报错

坏习惯7:文件操作不关闭资源

错误示范:

# 忘记关闭文件file = open("data.txt""r")content = file.read()# 忘记file.close(),可能导致资源泄漏# 在异常情况下文件未关闭file = open("data.txt""r")try:content = file.read()process(content)  # 可能抛出异常finally:file.close()  # 正确,但容易忘记

导致的问题:

  • 文件描述符泄漏

  • 数据可能未写入磁盘

  • 其他进程无法访问文件

正确做法:

# 方法1:使用with语句(推荐)withopen("data.txt""r"asfile:content = file.read()# 文件会自动关闭# 方法2:处理多个文件withopen("input.txt""r"asinfileopen("output.txt""w"asoutfile:content = infile.read()outfile.write(content.upper())# 方法3:使用pathlib(更现代)frompathlibimportPathfile_path = Path("data.txt")content = file_path.read_text()  # 自动管理文件# 写入文件file_path.write_text("新内容")# 方法4:数据库连接等资源importsqlite3withsqlite3.connect("database.db"asconn:cursor = conn.cursor()cursor.execute("SELECT * FROM users")results = cursor.fetchall()# 连接会自动关闭和提交

如何改掉这些坏习惯?

第一步:代码审查清单每次提交代码前,检查这些问题:

  1. [ ] 变量命名是否清晰?

  2. [ ] 是否处理了可能的None值?

  3. [ ] 是否使用了可变默认参数?

  4. [ ] 异常处理是否恰当?

  5. [ ] 是否添加了类型提示?

  6. [ ] 资源是否正确关闭?

第二步:使用自动化工具

# 安装代码检查工具pip install pylint flake8 mypy black# 配置预提交钩子# .pre-commit-config.yamlrepos:- repo: https://github.com/pre-commit/pre-commit-hooks    rev: v4.4.0    hooks:- id: trailing-whitespace- id: end-of-file-fixer- id: check-yaml- repo: https://github.com/psf/black    rev: 23.3.0    hooks:- id: black- repo: https://github.com/pycqa/flake8    rev: 6.0.0    hooks:- id: flake8

第三步:建立团队规范

# coding_standards.py"""团队编码规范"""# 1. 所有函数必须有类型提示# 2. 所有异常必须明确处理# 3. 所有资源必须使用with语句# 4. 变量名必须清晰# 5. 提交前必须通过mypy检查

第四步:定期重构每周花1小时,重构一段旧代码:

  1. 添加缺失的类型提示

  2. 改进变量命名

  3. 优化异常处理

  4. 添加文档字符串


好的编程习惯就像好的卫生习惯:每天刷牙很麻烦,但能避免牙疼。每天多花5分钟检查代码,能避免5小时的调试。优秀的开发者不是不写bug,而是不让bug活到生产环境。

“无他,惟手熟尔”!有需要的用起来!
如果你觉得这篇文章有用,欢迎点赞、转发、收藏、留言、推荐

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-02 23:33:46 HTTP/2.0 GET : https://f.mffb.com.cn/a/496075.html
  2. 运行时间 : 0.430168s [ 吞吐率:2.32req/s ] 内存消耗:4,918.77kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=a0f2db7cdc1e207c38478664dee7ffea
  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.000606s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000787s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000331s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000272s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000543s ]
  6. SELECT * FROM `set` [ RunTime:0.000239s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000585s ]
  8. SELECT * FROM `article` WHERE `id` = 496075 LIMIT 1 [ RunTime:0.034994s ]
  9. UPDATE `article` SET `lasttime` = 1783006426 WHERE `id` = 496075 [ RunTime:0.033821s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000290s ]
  11. SELECT * FROM `article` WHERE `id` < 496075 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000752s ]
  12. SELECT * FROM `article` WHERE `id` > 496075 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000406s ]
  13. SELECT * FROM `article` WHERE `id` < 496075 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.048135s ]
  14. SELECT * FROM `article` WHERE `id` < 496075 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.096407s ]
  15. SELECT * FROM `article` WHERE `id` < 496075 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.146636s ]
0.431795s