当前位置:首页>python>《Python基础及应用》第3章 分支程序设计-3.1 关系与逻辑运算

《Python基础及应用》第3章 分支程序设计-3.1 关系与逻辑运算

  • 2026-03-26 18:15:19
《Python基础及应用》第3章 分支程序设计-3.1 关系与逻辑运算

教学平台:Anaconda Jupyter Notebook

第3章 分支程序设计

3.1 关系与逻辑运算

📚 本节学习目标

掌握Python中的6种关系运算符及其优先级

理解3种逻辑运算符的短路特性

掌握is运算符与==的本质区别

能够运用关系与逻辑运算解决实际问题

学会使用AI工具辅助编程学习

3.1.1 关系运算

一、什么是关系运算?

关系运算(Relational Operations) 用于比较两个值之间的关系,运算结果为布尔值(TrueFalse)。

💡 回忆第2章:还记得我们在2.2.3节学过的逻辑型数据吗?关系运算的结果就是bool类型,只有True(真)和False(假)两个取值。

二、Python中的6种关系运算符

运算符

含义

示例

结果

记忆口诀

==

等于

5 == 5

True

两个等号判相等

!=

不等于

5 != 3

True

感叹等号判不等

>

大于

5 > 3

True

开口朝大数

<

小于

3 < 5

True

尖尖朝小数

>=

大于等于

5 >= 5

True

大于加上等于

<=

小于等于

3 <= 5

True

小于加上等于

三、详细知识点讲解与案例

知识点1:基本数值比较

# 重庆CK大学学生成绩比较案例score_zhang = 85  # 张同学Python成绩score_li = 92     # 李同学Python成绩print("=== CK大学学生成绩比较 ===")print(f"张同学成绩: {score_zhang}")print(f"李同学成绩: {score_li}")print(f"张同学成绩等于李同学吗? {score_zhang == score_li}")print(f"张同学成绩不等于李同学吗? {score_zhang != score_li}")print(f"张同学成绩大于李同学吗? {score_zhang > score_li}")print(f"张同学成绩小于李同学吗? {score_zhang < score_li}")print(f"张同学成绩大于等于85吗? {score_zhang >= 85}")print(f"李同学成绩小于等于90吗? {score_li <= 90}")

运行结果:

=== CK大学学生成绩比较 ===张同学成绩: 85李同学成绩: 92张同学成绩等于李同学吗? False张同学成绩不等于李同学吗? True张同学成绩大于李同学吗? False张同学成绩小于李同学吗? True张同学成绩大于等于85吗? True李同学成绩小于等于90吗? False

🔗 知识串联:这里使用了字符串格式化方法(f-string),用{}嵌入变量值,让输出更加清晰美观。

知识点2:连续比较(Python特色)

Python支持数学中的连续比较写法,这是Python的优雅特性之一:

# 判断CK大学某学生成绩是否在优良区间[80, 90]score = 85# 传统写法(其他语言)# result = (score >= 80) and (score <= 90)# Python优雅写法result = 80 <= score <= 90print(f"成绩{score}是否在优良区间[80,90]? {result}")# 更多连续比较示例a, b, c = 555print(f"\n5 == 5 == 5 的结果: {a == b == c}")  # 相当于 (a == b) and (b == c)x, y, z = 123print(f"1 < 2 < 3 的结果: {x < y < z}")        # 相当于 (x < y) and (y < z)print(f"1 < 3 < 2 的结果: {1 < 3 < 2}")        # 相当于 (1 < 3) and (3 < 2) -> False

运行结果:

成绩85是否在优良区间[80,90]? True5 == 5 == 5 的结果: True1 < 2 < 3 的结果: True1 < 3 < 2 的结果: False

⚠️ 注意1 < 3 < 2不是判断3是否在1和2之间,而是判断1<3并且3<2,后者为False,所以整体为False。

知识点3:字符串比较

字符串比较基于ASCII码值逐字符比较:

# CK大学图书馆索书号比较book1 = "TP312PY-45"book2 = "TP312PY-5"book3 = "Python基础"print("=== CK大学图书馆索书号比较 ===")print(f"'{book1}' == '{book2}': {book1 == book2}")print(f"'{book1}' < '{book2}': {book1 < book2}")  # 逐字符比较,'4'的ASCII(52) < '5'的ASCII(53)# 字符串大小写敏感username = "Admin"input_name = "admin"print(f"\n用户名比较(大小写敏感):")print(f"'{username}' == '{input_name}': {username == input_name}")# 统一转小写后比较print(f"转小写后比较: {username.lower() == input_name.lower()}")

运行结果:

=== CK大学图书馆索书号比较 ==='TP312PY-45' == 'TP312PY-5': False'TP312PY-45' < 'TP312PY-5': True用户名比较(大小写敏感):'Admin' == 'admin': False转小写后比较: True

🔗 串联回忆:这里使用了第2章2.4.3节学习的字符串方法lower(),将字符串转换为小写。还记得还有哪些字符串方法吗?upper()strip()replace()等。

知识点4:浮点数比较的陷阱

# CK大学物理实验数据比较# 浮点数存在精度问题,直接使用==比较可能出错a = 0.1 + 0.2b = 0.3print(f"0.1 + 0.2 = {a}")print(f"0.3 = {b}")print(f"0.1+0.2 == 0.3 ? {a == b}")  # 可能为False!# 正确做法:使用abs()函数判断差值是否足够小epsilon = 1e-10  # 精度阈值print(f"\n使用精度比较: abs({a} - {b}) < {epsilon}")print(f"结果: {abs(a - b) < epsilon}")# 或者使用round()函数print(f"\n使用round比较: round({a}, 10) == round({b}, 10)")print(f"结果: {round(a, 10) == round(b, 10)}")

运行结果:

0.1 + 0.2 = 0.300000000000000040.3 = 0.30.1+0.2 == 0.3 ? False使用精度比较: abs(0.30000000000000004 - 0.3) < 1e-10结果: True使用round比较: round(0.30000000000000004, 10) == round(0.3, 10)结果: True

🔗 串联回忆abs()是第2章2.3.3节提到的内置函数,返回绝对值。浮点数精度问题是计算机存储原理导致的,记住:永远不要直接用==比较两个浮点数是否相等!

知识点5:不同数据类型的比较

# CK大学学生信息系统中不同类型数据的比较age = 20          # intheight = 175.5    # floatstudent_id = "20230101"  # strprint("=== 数值类型之间可以比较 ===")print(f"age(20) == height(175.5): {age == height}")  # False,但语法允许print(f"age(20) < height(175.5): {age < height}")    # True,整数自动转为浮点数比较print("\n=== 数值与字符串比较(Python 3禁止)===")try:    result = age > student_idexcept TypeError as e:    print(f"错误提示: {e}")    print("Python 3中,不同类型的数据不能比较大小,只能比较是否相等(结果为False)")print(f"\n年龄(20) == 学号('20230101'): {age == student_id}")  # False,类型不同

运行结果:

=== 数值类型之间可以比较 ===age(20) == height(175.5): Falseage(20) < height(175.5): True=== 数值与字符串比较(Python 3禁止)===错误提示: '>' not supported between instances of 'int' and 'str'Python 3中,不同类型的数据不能比较大小,只能比较是否相等(结果为False)年龄(20) == 学号('20230101'): False

四、关系运算符优先级

# 优先级:算术运算 > 关系运算 > 赋值运算# 关系运算符之间优先级相同,从左到右计算# 复杂表达式示例x, y, z = 102030result = x + y > z - 5  # 先算算术运算:10+20 > 30-5 -> 30 > 25 -> Trueprint(f"x + y > z - 5 的结果: {result}")# 使用括号提高可读性(推荐)result = (x + y) > (z - 5)print(f"加括号后 (x + y) > (z - 5): {result}")

3.1.2 逻辑运算

一、什么是逻辑运算?

逻辑运算(Logical Operations) 用于组合多个关系表达式,实现复杂的条件判断。

💡 回忆第2章:我们在2.2.3节学过,布尔类型bool只有两个值TrueFalse。逻辑运算就是对这些布尔值进行”与”、“或”、“非”操作。

二、Python中的3种逻辑运算符

运算符

含义

运算规则

记忆口诀

and

逻辑与

两边都为True,结果才为True

一假则假,全真才真

or

逻辑或

两边只要有一个True,结果就为True

一真则真,全假才假

not

逻辑非

取反,TrueFalse,FalseTrue

真假互换

三、真值表(Truth Table)

and运算真值表

A

B

and B

True

True

True

True

False

False

False

True

False

False

False

False

or运算真值表

A

B

or B

True

True

True

True

False

True

False

True

True

False

False

False

not运算真值表

A

not A

True

False

False

True

四、详细知识点讲解与案例

知识点1:基本逻辑运算

# CK大学奖学金评定条件案例# 评定一等奖学金需要:成绩>=90 并且 品德优秀score = 92is_moral_excellent = Trueprint("=== CK大学一等奖学金评定 ===")print(f"学生成绩: {score}")print(f"品德优秀: {is_moral_excellent}")# 使用and组合条件can_get_scholarship = (score >= 90and is_moral_excellentprint(f"是否符合一等奖学金条件(成绩>=90 且 品德优秀): {can_get_scholarship}")# 评定助学金需要:家庭困难 或者 成绩优异is_family_difficult = Falseis_score_excellent = Truecan_get_grant = is_family_difficult or is_score_excellentprint(f"\n是否符合助学金条件(家庭困难 或 成绩优异): {can_get_grant}")# 使用not取反is_absent = Falsecan_take_exam = not is_absent  # 没有缺勤才能参加考试print(f"\n是否允许参加考试(未缺勤): {can_take_exam}")

运行结果:

=== CK大学一等奖学金评定 ===学生成绩: 92品德优秀: True是否符合一等奖学金条件(成绩>=90 且 品德优秀): True是否符合助学金条件(家庭困难 或 成绩优异): True是否允许参加考试(未缺勤): True

知识点2:短路求值(Short-circuit Evaluation)

Python的逻辑运算具有短路特性:如果前面的表达式已经能确定整个表达式的结果,后面的表达式就不会执行。

# 短路求值演示print("=== 逻辑与(and)的短路特性 ===")# and运算:只要遇到False,结果就是False,后面不再计算x = 10result = (x < 5and (print("这行不会执行"))  # x<5为False,后面不执行print(f"结果: {result}")print("\n=== 逻辑或(or)的短路特性 ===")# or运算:只要遇到True,结果就是True,后面不再计算y = 20result = (y > 10or (print("这行不会执行"))  # y>10为True,后面不执行print(f"结果: {result}")# 实际应用:防止除零错误denominator = 0numerator = 100# 安全除法:先判断分母不为0,再计算# 如果分母为0,前面的条件为False,后面不会执行除法,避免报错if (denominator != 0and (numerator / denominator > 10):    print("结果大于10")else:    print("分母为0或结果不大于10(安全地避开了除零错误)")

运行结果:

=== 逻辑与(and)的短路特性 ===结果: False=== 逻辑或(or)的短路特性 ===结果: True分母为0或结果不大于10(安全地避开了除零错误)

知识点3:逻辑运算符的优先级与结合性

优先级:not > and > or建议使用括号明确优先级,提高代码可读性

# CK大学选课系统案例# 选课条件:不是必修课(not) 并且 学分未满(and) 或者 是选修课并且时间合适(or)is_required = False      # 不是必修课credits_full = False     # 学分未满is_elective = True       # 是选修课time_suitable = True     # 时间合适# 不加括号的写法(容易混淆)# result = not is_required and not credits_full or is_elective and time_suitable# 等价于:((not is_required) and (not credits_full)) or (is_elective and time_suitable)# 加括号的写法(清晰推荐)can_select = ((not is_required) and (not credits_full)) or (is_elective and time_suitable)print(f"是否可以选择该课程: {can_select}")# 复杂条件拆解示例# 判断CK大学学生是否可以毕业:# 条件1:修满学分(总学分>=160)# 条件2:通过英语四级(成绩>=425)# 条件3:没有违纪记录# 条件4:完成毕业论文(成绩>=60)total_credits = 165cet4_score = 430has_violation = Falsethesis_score = 75can_graduate = (total_credits >= 160and (cet4_score >= 425and (not has_violation) and (thesis_score >= 60)print(f"\n=== CK大学毕业资格审核 ===")print(f"总学分: {total_credits} (要求>=160)")print(f"CET4成绩: {cet4_score} (要求>=425)")print(f"是否有违纪: {has_violation}")print(f"毕业论文成绩: {thesis_score} (要求>=60)")print(f"\n是否符合毕业条件: {can_graduate}")

运行结果:

是否可以选择该课程: True=== CK大学毕业资格审核 ===总学分: 165 (要求>=160)CET4成绩: 430 (要求>=425)是否有违纪: False毕业论文成绩: 75 (要求>=60)是否符合毕业条件: True

知识点4:非布尔值的逻辑运算

Python中,非布尔值也可以进行逻辑运算,遵循以下规则: 

and:如果第一个值为假,返回第一个值;否则返回第二个值 

or:如果第一个值为真,返回第一个值;否则返回第二个值 

not:返回TrueFalse

# 非布尔值的逻辑运算(常用于设置默认值)print("=== and运算返回最后一个真值或第一个假值 ===")print(f"5 and 3: {5and3}")      # 5为真,返回3print(f"0 and 3: {0and3}")      # 0为假,返回0print(f"'hello' and 'world': {'hello'and'world'}")print("\n=== or运算返回第一个真值或最后一个假值 ===")print(f"5 or 3: {5or3}")        # 5为真,返回5print(f"0 or 3: {0or3}")        # 0为假,返回3print(f"'' or 'default': {''or'default'}")print("\n=== not运算总是返回布尔值 ===")print(f"not 5: {not5}")          # Falseprint(f"not 0: {not0}")          # Trueprint(f"not 'hello': {not'hello'}")  # False(非空字符串为真)# 实际应用:设置默认值username = ""display_name = username or "匿名用户"print(f"\n用户名: '{username}'")print(f"显示名称: '{display_name}'")

运行结果:

=== and运算返回最后一个真值或第一个假值 ===5 and 3: 30 and 3: 0'hello' and 'world': world=== or运算返回第一个真值或最后一个假值 ===5 or 3: 50 or 3: 3'' or 'default': default=== not运算总是返回布尔值 ===not 5: Falsenot 0: Truenot 'hello': False用户名: ''显示名称: '匿名用户'

🔗 串联回忆:这里涉及到第2章2.2节的数据类型知识。在Python中,以下值被视为”假”(False等价):00.0''(空字符串)、[](空列表)、{}(空字典)、None等。

3.1.3 is运算符

一、is==的区别

这是Python初学者最容易混淆的概念之一:

运算符

比较内容

使用场景

==

值相等(value equality)

比较两个对象的值是否相同

is

身份相同(identity)

比较两个对象是否是同一个对象(内存地址相同)

💡 形象比喻==比较的是两个人的长相是否一样(内容),is比较的是两个人是否是同一个人(内存地址)。

二、详细知识点讲解与案例

知识点1:基础对比

# CK大学学生信息管理系统案例# 两个学生信息字典,内容完全相同student1 = {'name''张三''age'20'school''CK'}student2 = {'name''张三''age'20'school''CK'}student3 = student1  # student3指向同一个对象print("=== 值相等 vs 身份相同 ===")print(f"student1: {student1}")print(f"student2: {student2}")print(f"student3: {student3}")print(f"\nstudent1 == student2 (值相等): {student1 == student2}")  # True,内容相同print(f"student1 is student2 (身份相同): {student1 is student2}")  # False,不同对象print(f"student1 is student3 (身份相同): {student1 is student3}")  # True,同一对象# 查看内存地址(id)print(f"\nstudent1的id: {id(student1)}")print(f"student2的id: {id(student2)}")print(f"student3的id: {id(student3)}")

运行结果:

=== 值相等 vs 身份相同 ===student1: {'name': '张三', 'age': 20, 'school': 'CK'}student2: {'name': '张三', 'age': 20, 'school': 'CK'}student3: {'name': '张三', 'age': 20, 'school': 'CK'}student1 == student2 (值相等): Truestudent1 is student2 (身份相同): Falsestudent1 is student3 (身份相同): Truestudent1的id: 140234567890234student2的id: 140234567890456student3的id: 140234567890234

知识点2:小整数缓存机制

Python对小整数(-5到256)有缓存优化,这会导致is的意外行为:

# Python的小整数缓存机制a = 100b = 100print(f"a = 100, b = 100")print(f"a == b: {a == b}")    # Trueprint(f"a is b: {a is b}")    # True(因为100在缓存范围内)c = 1000d = 1000print(f"\nc = 1000, d = 1000")print(f"c == d: {c == d}")    # Trueprint(f"c is d: {c is d}")    # 是False(超出缓存范围,不同对象)# 字符串也有类似的驻留机制str1 = "hello"str2 = "hello"print(f"\nstr1 = 'hello', str2 = 'hello'")print(f"str1 == str2: {str1 == str2}")  # Trueprint(f"str1 is str2: {str1 is str2}")  # True(字符串驻留)str3 = "hello world!"str4 = "hello world!"print(f"\nstr3 = 'hello world!', str4 = 'hello world!'")print(f"str3 == str4: {str3 == str4}")  # Trueprint(f"str3 is str4: {str3 is str4}")  # 是False(含空格,不驻留)

⚠️ 重要提示:不要依赖is来比较值!比较值永远用==,is只用于判断是否是同一个对象。

知识点3:is的典型使用场景

# 场景1:判断变量是否为None(最常用)data = None# 正确写法if data is None:    print("数据为空")# 错误写法(虽然结果对,但不推荐)# if data == None:# 场景2:检查对象是否是同一个config_default = {'debug'False'school''CK'}config_current = config_defaultif config_current is config_default:    print("当前配置使用的是默认配置对象")# 场景3:配合not使用value = Noneif value is not None:  # 注意:不是 "if not value is None"    print("值不为None")# 对比empty_list = []if empty_list is not None:    print("empty_list不是None(它是空列表)")if not empty_list:  # 空列表为False    print("但empty_list是假值")

知识点4:is与可变对象、不可变对象

# CK大学课程列表管理# 不可变对象:修改会创建新对象course_code = "CS101"print(f"原始id: {id(course_code)}")course_code = course_code + "A"print(f"修改后id: {id(course_code)}")  # id变了,说明是新对象print("\n=== 可变对象:修改不改变id ===")# 可变对象:修改不会改变对象身份students = ["张三""李四"]print(f"原始列表: {students}, id: {id(students)}")students.append("王五")print(f"添加后: {students}, id: {id(students)}")  # id不变# 重要区别list1 = [123]list2 = list1           # 引用同一个对象list3 = list1.copy()    # 创建副本(新对象)print(f"\nlist1: {list1}")print(f"list2 is list1: {list2 is list1}")  # Trueprint(f"list3 is list1: {list3 is list1}")  # Falseprint(f"list3 == list1: {list3 == list1}")  # True

三、本节知识总结

# 快速参考卡片print("=== 关系与逻辑运算速查表 ===")print("""【关系运算】==等于!=不等于>大于<小于>=大于等于<=小于等于【逻辑运算】and与(一假则假)or或(一真则真)not非(取反)【身份运算】is判断是否为同一对象is not判断是否不是同一对象【重要区别】==比较值is比较身份(内存地址)【使用建议】1. 比较数值、字符串内容用 ==2. 判断是否为None用 is3. 复杂条件用括号提高可读性4. 浮点数比较用 abs(a-b) < epsilon""")

🤖 AI辅助学习:用AI深化本节知识

一、为什么要用AI学编程?

AI可以:

 - 解释你不懂的概念(用不同方式讲解) 

- 生成练习题和案例 

- 帮你调试代码错误 

- 将知识应用到有趣的项目中

二、本节课的AI练习任务

练习1:关系运算可视化

任务:让AI帮你创建一个可视化工具,展示关系运算的结果。

给AI的提示词(Prompt):

请用Python的turtle库或matplotlib库,帮我绘制一个"关系运算可视化"的图形。要求:1. 画出两个圆圈,分别代表两个数值A和B2. 用不同颜色显示A>B、A==B、A         <B三种情况< span>          </B三种情况<>3. 在图形下方用文字显示当前的关系运算结果4. 让A和B的值可以通过键盘输入或随机变化5. 添加标题"CK大学Python关系运算演示"请给出完整的、可运行的Python代码,并解释代码的关键部分。

学习目标:通过可视化加深对关系运算的理解,同时复习turtle或matplotlib的使用。

练习2:逻辑电路模拟器

任务:用AI帮你创建一个逻辑门电路模拟器。

给AI的提示词(Prompt):

我正在学习Python的逻辑运算(and、or、not)。请帮我编写一个"逻辑电路模拟器"程序,要求:1. 模拟基本的逻辑门:与门(AND)、或门(OR)、非门(NOT)2. 允许用户输入两个布尔值(True/False或1/0)3. 显示这三个逻辑门的输出结果4. 用ASCII字符画出简单的电路图5. 添加一个功能:输入一个复合逻辑表达式(如"A and B or not C"),计算并显示真值表6. 在代码注释中解释短路求值的原理请确保代码适合Python初学者理解,使用清晰的变量名和注释。

学习目标:理解逻辑运算在数字电路中的应用,掌握复合逻辑表达式的计算。

练习3:CK大学智能评分系统

任务:结合重庆本地特色,创建一个智能评分系统。

给AI的提示词(Prompt):

我是CK大学(重庆)的学生,正在学习Python的关系和逻辑运算。请帮我设计一个"重庆火锅口味推荐系统",要求:1. 输入用户的口味偏好:辣度(1-5)、麻度(1-5)、油量(清淡/适中/重油)2. 输入用户的身体状态:是否有胃病(是/否)、是否容易上火(是/否)3. 使用逻辑运算判断:- 如果辣度>3 并且 有胃病 → 推荐"微辣养生锅"- 如果辣度>4 或者 麻度>4 → 推荐"经典老火锅"- 如果容易上火 并且 油量=="重油" → 推荐"清汤锅"- 其他情况 → 推荐"鸳鸯锅"4. 输出推荐结果和理由(使用了哪些逻辑判断)5. 用emoji让输出更生动请给出完整的Python代码,并解释其中使用的逻辑运算符。

学习目标:将逻辑运算应用到实际决策系统中,理解条件组合的实际意义。

练习4:is运算符深度探索

任务:探索Python的内存管理机制。

给AI的提示词(Prompt):

请帮我编写一个Python程序,深入探索'is'运算符和'=='运算符的区别,要求:1. 展示不同数据类型(int、float、str、list、dict)使用is和==的结果对比2. 展示Python的整数缓存机制(-5到256)3. 展示字符串驻留机制4. 展示可变对象和不可变对象在使用is时的区别5. 创建一个函数,接收两个参数,详细分析它们的关系:- 值是否相等(==)- 身份是否相同(is)- 如果是容器类型(列表、字典),检查它们的内容是否相等但身份不同6. 在输出中使用表格形式展示结果请确保代码有良好的注释,适合教学使用。

学习目标:深入理解Python的内存模型,避免在实际编程中误用is

练习5:创意编程——逻辑运算艺术

任务:用逻辑运算生成ASCII艺术。

给AI的提示词(Prompt):

我想用Python的逻辑运算来生成ASCII艺术图案。请帮我编写程序:1. 创建一个10x10的网格2. 使用关系运算和逻辑运算决定每个位置是否打印字符3. 例如:如果 (x > 3 and x < 7) or (y > 3 and y < 7) 则打印"*",否则打印" "4. 生成至少3种不同的图案(如:十字、对角线、圆形近似)5. 添加一个功能:让用户输入逻辑表达式,实时预览生成的图案6. 在注释中解释每个图案使用的逻辑运算原理请给出完整的代码,并确保可以在Jupyter Notebook中运行。

学习目标:理解逻辑运算在图形生成中的应用,培养计算思维。

三、与AI对话的技巧

1.明确目标:告诉AI你的学习阶段(初学者)和具体需求

2.提供上下文:说明你在学习什么知识点(如”我正在学习Python的is运算符”)

3.要求解释:不要只要代码,要求AI解释关键概念

4.迭代改进:先让AI生成基础版本,然后逐步添加功能

5.验证理解:让AI出几道测试题检验你的理解

四、本节课的AI测试题

让AI给你出以下类型的题目:

提示词:

我是Python初学者,刚学习了关系运算(==、!=、>、<、>=、<=)、逻辑运算(and、or、not)和is运算符。请给我出5道练习题:1. 2道关系运算题(包含连续比较和浮点数比较陷阱)2. 2道逻辑运算题(包含短路求值的应用)3. 1道is与==的辨析题(考察身份与值的区别)每道题给出:- 题目代码- 四个选项(A、B、C、D)- 正确答案- 详细解释(为什么正确,其他选项为什么错)

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-03-27 11:46:31 HTTP/2.0 GET : https://f.mffb.com.cn/a/481946.html
  2. 运行时间 : 0.191170s [ 吞吐率:5.23req/s ] 内存消耗:4,846.04kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=9aecae9c7b4872aa6a1c49f16d128886
  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.000475s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000644s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000323s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.004836s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000554s ]
  6. SELECT * FROM `set` [ RunTime:0.007788s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000619s ]
  8. SELECT * FROM `article` WHERE `id` = 481946 LIMIT 1 [ RunTime:0.008075s ]
  9. UPDATE `article` SET `lasttime` = 1774583191 WHERE `id` = 481946 [ RunTime:0.003975s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000441s ]
  11. SELECT * FROM `article` WHERE `id` < 481946 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000973s ]
  12. SELECT * FROM `article` WHERE `id` > 481946 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.021462s ]
  13. SELECT * FROM `article` WHERE `id` < 481946 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.004457s ]
  14. SELECT * FROM `article` WHERE `id` < 481946 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.044924s ]
  15. SELECT * FROM `article` WHERE `id` < 481946 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.020249s ]
0.192882s