当前位置:首页>python>32岁零基础学Python量化 第2周(附加篇):花了几天,写了第一个能用的记账小程序

32岁零基础学Python量化 第2周(附加篇):花了几天,写了第一个能用的记账小程序

  • 2026-06-28 10:47:22
32岁零基础学Python量化 第2周(附加篇):花了几天,写了第一个能用的记账小程序
接上篇的《Python编程从入门到实践》第三版 学习笔记 下(8~9章节),今天更新第10章,此篇属于附加篇1,包括文件的存取和异常的处理,之前说一周学完发现太难了,根本学不完!本来准备上中下就写完的,硬是拖出了两个附加篇,不管怎样,基础打实了才是最重要的,下面开始第10章的文件和异常的笔记。
第10章:文件和异常
  • 本章重点
本章学习如何读写文件、处理程序错误以及保存数据。
1. 读取文件(path.read_text()
1.1  导入pathlib模块中的Path类的方法read_text()读取文本文件内容
#读取txt文件,使用pathlib库读取路径from pathlib import Path #从pathlib模块导入Path类path = Path('pi_digits.txt')  #新建Path对象指向一个‘pi_digits.txt’文件#使用Path类的方法read_text(),将文件内容作为字符串返回给变量contentscontents = path.read_text()  print(contents) 
输出:
D:\Jupyter\Python Study>file_reader.py3.1415926535  8979323846  2643383279
这里有一个问题,结尾部分有一空行,使用结尾空白删除方法:rstrip()也无法消除,后来查阅print()函数发现有一默认参数end='\n',也就是打印后结尾会默认换行此处手动将其改为空白则换行取消,结尾无多余行
#读取文件from pathlib import Path  #导入Path类file_path = Path('pi_digits.txt'#创建Path类的一个对象#方法链式调用读取文件内容并删除结尾空格contents = file_path.read_text().rstrip()#print()函数有一个默认参数end='\n',默认结尾换行,#手动改为end=''空白则会消除这一行为print(contents,end='')  
输出:
D:\Jupyter\Python Study>file_reader.py3.141592653589793238462643383279
注:
contents = file_path.read_text().rstrip()
此行代码展现了方法链式调用(method chaining),从左到右依次执行方法,编程时可以简化代码
ctrl+o 快捷键:打开当前程序所在文件夹
1.2 指定路径的方式:
①相对文件路径:file_path = Path('text_files/pi_digits.txt')  用于文件在当前程序所在文件夹中的子文件夹内的情况,程序在所在文件夹中查找text_files文件夹,然后进入再查找pi_digits.txt文件。
②绝对文件路径:file_path  =  Path('D:/Jupyter/Python Study/text_files/pi_digits.txt')从根目录出发可读取系统中任何位置文件,注意要是斜杠而不是你直接copy过来的带反斜杠的地址。
1.3 splitelines()方法将冗长字符串转换为一系列行:
#(省略前面代码)示例 lines = contents.splitlines()for line in lines:print(line)
不加splitlines()方法的结果:
from pathlib import Pathfile_path = Path('D:/Jupyter/Python Study/text_files/pi_digits.txt')contents = file_path.read_text()for line in contents:print(line)
3.141592653
(注:不加splitlines()时,contents 是一个大字符串,for 循环遍历的是每个字符,而不是每一行)
加splitlines()结果:
from pathlib import Pathfile_path = Path('D:/Jupyter/Python Study/text_files/pi_digits.txt')contents = file_path.read_text().splitlines()for line in contents:print(line)
D:\Jupyter\Python Study>splitlines.py3.1415926535  8979323846  2643383279
1.4 操作文件内字符串,将多行合并为一行,删除中间的空格strip()
lines = contents.splitlines()pi_string = ''for line in lines:	pi_string = pi_string+line.strip() print(pi_string)
2.写入文件(path.write_text()
from pathlib import Pathpath = Path('programming.txt')#新建一个对象关联到一个文件名 path.write_text('I love programming'#调用path类中的write_text()方法 
注:只能将字符串写入文本文件,若想写入数值则需使用str()转换为文本
例题:新建一个文本文件,提醒用户写入姓名,最后将文件读取并按行打
印出来
输出结果:
错误解析:最后输出没有按要求按行输出,原因在于写入的时候是按字符串连续相加,中间没有换行符‘\n’,因此读取的时候自然也是输出一段连续的结果,所以只要在拼接每个姓名的时候在中间增加一个换行符即可
修改:增加一个换行符'\n'
3.异常处理 
3.1try — except—else
python 使用称为异常(exception)的特殊对象来管理执行发生的错误,每当错误发生它会创建一个异常对象,若你已编写处理该异常的代码,程序将继续运行,若没有,程序将停止并显示一个traceback,其中包含异常的报告,try-except 代码块的作用就是即便出现异常,程序也将继续运行并显示你编写的内容来告诉用户出了什么错。
踩坑代码:
踩坑说明:①input() 在输入是数字的情况下也会将其转换为字符串,因此需加int() : num = int(input('请输入除数:')),这里没加,然后用数值10除以字符串,会出现一个TypeError
②except后未加ZeroDivisionError(除零错误),因此其等价于except Exception(所有异常(除了系统级异常如强制终止程序的ctrl+C)),所以上面的TypeError也包括在内,因此执行except下面内容,在这里我们只交代除0错误才执行这条命令,因此需加ZeroDivisionError。
依赖try代码块成功执行的代码都被放在else代码块中,如果除法运算成功,就使用else代码块来打印结果
改后代码:
3.2 静默失败 : pass代码可以让代码像什么都没有发生一样,充当一个占位符,程序会继续运行
4.存储数据(JSON):
4.1 json.dumps()   json.loads()  的使用:

json保存用户生成的数据在程序停止运行时仍被存储,重新打开时数据还在

输出:
json的使用需要注意3点:
①.其存储格式必须为json格式;
②.写入数据和前面不一样的是需要在写入前加一个使普通数据转为json格式的步骤:contents = json.dumps(num),然后才是和前面一样用write_text()方法写入;
③读取时先正常用read_text()读取数据,然后把读取出来的json形式的数据使用json.loads()函数转为普通数据打印出来。
总的来说,json的使用一句话概括为:数据的序列化与反序列化
4.2  path.exists() 判断的使用:用于判断这个路径文件是否存在配合if语句使用可在文件存在时输出,不存在时选择写入。
  • 本章实践项目
编写一个程序,可以实现一个记账簿的功能:用户可以输入对应的日期,项目,项目花费,然后将这些内容存在一个json文件中,同时用户可以查看账簿,关闭程序后重新打开,仍可以查看以前内容。
项目分析:考察pathlib进行文件的读写,json模块的读写功能,字典的嵌套,数据结构设计,if条件语句的使用,异常处理(try/except)保障程序安全。
1.答题(包括了错误代码的分析):
#导入模块及函数:from pathlib import Path #从pathlib库中导入Path类import json  #导入json模块path = Path('user_information.json')#1——每次启动都会重置为空字典,导致记录丢失,应先尝试读取数据user_information = {}  records = {}print('---欢迎使用记账簿---')#子函数:def information_input():	time = ''while True:print('请按顺序输入日期,商品名,花费:')		time = input('日期(如:5/31):')if time == 'q':break#2——在输入商品名或花费时输入q会直接跳出循环导致以输入的日期没有对应数据		item = input('商品名称:')if item == 'q':break#3——花费应直接转为float方便日后统计		cost = input('花费(单位¥):')if cost == 'q':break#4——数据共享错误:全局变量records = {}在每次调用information_input()时反复使用且所有日期都指向这同一个字典对象		records[item] = cost		user_information[time] = records	contents = json.dumps(user_information)	path.write_text(contents)return pathdef information_output():if path.exists():		contents = path.read_text()		information = json.loads(contents)return informationelse:#5——文件不存在时没有任何返回值,会隐式返回一个None,导致主程序打印None,应返回明确的空字典{}print('内容为空,请先记账')#主程序:while True:	active = input('请问是输入还是查看数据(输入请输:i,查看请输:o,退出请输:q):')#6——if结构错误,下面的else只是最后一个if的配对,因此只要不是'q'都会执行else内容if active == 'i':		information_input()if active == 'o':		user_informations = information_output()print(user_informations)if active == 'q':breakelse:print('请按提示输入!')print('---欢迎下次使用,再见!---')'''
2.修改后的代码(附修改说明):
#导入模块及函数:from pathlib import Path #从pathlib库中导入Path类import json  #导入json模块path = Path('user_information.json')#1——此处改为先尝试读取数据,同时加入try/except语句避免内容错误引起的异常if path.exists():    try:        user_information = json.loads(path.read_text())    except json.JSONDecodeError:      #json.JSONDecodeError是Python内置json模块抛出的解析异常,父类是ValueError    #触发场景:调用 json.loads(字符串)/json.load(文件)时,传入的内容不符合标准JSON语法,解析器无法转换成Python dict/list。        user_information = {}  #内容错误时重置为空字典else:    user_information = {}  #文件不存在时新建一个空字典print('---欢迎使用记账簿---')#子程序1def information_input():    """数据输入子程序"""    #date在输入前不需要先行定义,删除date = ''    #让用户先输入日期    date = input('请输入日期(如:5/31):').strip()  #strip用于删除用户多输入的空格    if date.lower() == 'q':   #加lower()防止输入为大写的Q        return    #需要优先取出该日期下已有的账簿,没有则新建空列表    #dict.get(key,b):获取dict字典中key对应的值,如果没有获取成功就返回设定值b,不会报错    records = user_information.get(date,[])      #如此日期已有记录,则获取该日期下的账簿,并继续在此日期上更新,没有则新建一个空列表用于记账    #2——按天来记录,如果当天记录完成,直接结束函数询问用户下一步操作    while True:            item = input('商品名称(输入q结束当天):').strip()        if item.lower() == 'q':              break        #3——input输入的花费默认为字符串形式,因此加后缀_str,后续调整为浮点数方便后续增加其他操作如统计当月花费        cost_str = input('花费¥(输入q结束当天):').strip()         if cost_str.lower() == 'q':            break        try:            cost = float(cost_str)        except ValueError:            print('花费请输入数字,本条记录未保存。')  #如果不是数字就会不记录并提醒用户输入正确数据            continue        #添加记录(商品重复视为两笔消费)        records.append({'项目':item,'花费':cost})     #4——数据共享错误:全局变量records = {}在每次调用information_input()时反复使用,导致所有日期都指向这同一个字典    if records: #只有在有记录时才保存        user_information[date] = records         # 数据结构为: {'日期1':[{'项目名1':花费},{'项目名2':花费},...],'日期2':[{'项目名1':花费},{'项目名2':花费}]}        #简化写法即:{date:records,date:records},records是一个嵌套了字典的列表。        path.write_text(json.dumps(user_information,ensure_ascii=False,indent=2)) #后面两个参数设定用于json数据的美化,可以省略        print('记录已保存。')    else:        print('当天无记录')        #因为数据已经保存到user_information中了,任务已经完成,后续要读取直接调用information_output()函数即可,无需返回值,因此return path去掉#子程序2def information_output():    """数据读取子程序"""    #if先判断文件是否存在,存在则读取,不存在则提醒用户先输入    if path.exists():        try:            contents = path.read_text()            information = json.loads(contents)            return information        except json.JSONDecodeError:            print('文件损坏,无法读取。')            return {} #文件不存在时没有任何返回值,会隐式返回一个None,导致主程序打印None,应返回明确的空字典{}    else:        #文件不存在时没有任何返回值,会隐式返回一个None,导致主程序打印None,应返回明确的空字典{}        print('内容为空,请先记账')#主程序:while True:    active = input('请问是输入还是查看数据(输入请输:i,查看请输:o,退出请输:q):').strip().lower()#5.if结构调整为if--elif--elif--else结构,保证前三项都不满足时才运行else结果。    if active == 'i':        information_input()    elif active == 'o':        user_informations = information_output()        print(user_informations)    elif active == 'q':        break    else:        print('请按提示输入!')print('---欢迎下次使用,再见!---')
(代码看着太小可以复制到自己的编辑器中查看)
3.代码输出正常:
4.实践总结:
1.对于有json的代码,应先尝试读取json文件,若有内容一般需要先导入;
2.数据复杂时可用字典的嵌套,使用前务必先确认好数据结构;
3.if-elif-else结构前两个条件不满足else才会执行;
4.善用try—except 可避免很多错误;
5.input()输入内容会被默认转为字符串格式,如需数字则需提前转换;
6.在提醒用户输入字母时需考虑用户可能输入大写,需用lower()转换;
7.函数目的若是将数据写入文件的一般无需返回值,因为数据已存进文件。
  • 本篇小结
此次实践题目融合了部分前面的基础知识,后续实践项目尽量会融合已经学过的知识,还是那句话:用以致学。
距离这次我写第一篇内容已经过去两周多了,主要是学习了Python的基础知识,另外还剩第11章未更新,《Python编程从入门到实践》这本书第一部分基础知识学完后面是游戏项目,个人觉得不符合我的需求,第11章更新完后,后面转numpy及pandas相关内容的学习,各位同学和前辈有什么心得或建议欢迎留言一起交流。
感谢看完~

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-03 09:32:47 HTTP/2.0 GET : https://f.mffb.com.cn/a/496702.html
  2. 运行时间 : 0.129640s [ 吞吐率:7.71req/s ] 内存消耗:4,626.90kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=9b2a0d07ee1e588b87ac6550f2c0c4ed
  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.000529s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000715s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.002943s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000326s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000637s ]
  6. SELECT * FROM `set` [ RunTime:0.000209s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000613s ]
  8. SELECT * FROM `article` WHERE `id` = 496702 LIMIT 1 [ RunTime:0.006436s ]
  9. UPDATE `article` SET `lasttime` = 1783042367 WHERE `id` = 496702 [ RunTime:0.024723s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000310s ]
  11. SELECT * FROM `article` WHERE `id` < 496702 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000665s ]
  12. SELECT * FROM `article` WHERE `id` > 496702 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000411s ]
  13. SELECT * FROM `article` WHERE `id` < 496702 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.001780s ]
  14. SELECT * FROM `article` WHERE `id` < 496702 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.000660s ]
  15. SELECT * FROM `article` WHERE `id` < 496702 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.021481s ]
0.131219s