当前位置:首页>python>Python条件控制语句详解

Python条件控制语句详解

  • 2026-07-02 05:14:58
Python条件控制语句详解

条件控制语句是Python编程中用于根据不同条件执行不同代码块的核心结构。本文将详细介绍Python的条件控制语句,包括基本语法、高级用法、最佳实践和常见错误。

一、条件控制概述

1. 什么是条件控制?

条件控制是编程语言中用于根据条件表达式的真假来决定执行哪段代码的结构。Python提供了多种条件控制语句,主要包括ifif-elseif-elif-else等。

2. 条件控制的基本原理

条件控制的基本原理是:

  1. 计算条件表达式的值(True或False)
  2. 如果条件为True,则执行相应的代码块
  3. 如果条件为False,则跳过相应的代码块或执行其他代码块

3. 条件表达式

条件表达式是返回布尔值(True或False)的表达式,常见的条件表达式包括:

  • 比较表达式(如a > ba == b
  • 逻辑表达式(如a and ba or bnot a
  • 成员关系表达式(如x in listx not in tuple
  • 身份表达式(如x is yx is not y
  • 真值测试(如if x:if not x:

二、if语句

1. 基本语法

if语句是最简单的条件控制语句,用于在条件为True时执行代码块:

# if语句的基本语法if 条件表达式:# 条件为True时执行的代码块    代码1    代码2...

2. 使用示例

# if语句示例# 比较表达式age =18if age >=18:print("你已经成年了")# 逻辑表达式=5=10if x >0and y >0:print("x和y都是正数")# 成员关系表达式fruits =["apple","banana","orange"]if"apple"in fruits:print("苹果在水果列表中")# 身份表达式=[1,2,3]=[1,2,3]= xif x is z:print("x和z是同一个对象")# 真值测试name ="张三"if name:print("姓名不为空")

3. 注意事项

  • 条件表达式后面必须加冒号:
  • 代码块必须使用缩进(通常是4个空格)
  • Python中没有大括号{}来表示代码块,完全依赖缩进
  • 缩进的层级必须一致,否则会导致语法错误

三、if-else语句

1. 基本语法

if-else语句用于在条件为True时执行一个代码块,在条件为False时执行另一个代码块:

# if-else语句的基本语法if 条件表达式:# 条件为True时执行的代码块    代码1    代码2...else:# 条件为False时执行的代码块    代码1    代码2...

2. 使用示例

# if-else语句示例# 比较表达式age =16if age >=18:print("你已经成年了")else:print("你还未成年")# 逻辑表达式=5=-10if x >0and y >0:print("x和y都是正数")else:print("x和y不都是正数")# 成员关系表达式fruits =["apple","banana","orange"]if"grape"in fruits:print("葡萄在水果列表中")else:print("葡萄不在水果列表中")# 真值测试name =""if name:print("姓名不为空")else:print("姓名为空")

3. 注意事项

  • else
    子句必须与if子句配对使用
  • else
    子句没有条件表达式
  • else
    子句的代码块也必须使用正确的缩进

四、if-elif-else语句

1. 基本语法

if-elif-else语句用于处理多个条件,当有多个条件需要判断时使用:

# if-elif-else语句的基本语法if 条件表达式1:# 条件1为True时执行的代码块    代码1...elif 条件表达式2:# 条件1为False且条件2为True时执行的代码块    代码1...elif 条件表达式3:# 条件1和2为False且条件3为True时执行的代码块    代码1...else:# 所有条件都为False时执行的代码块    代码1...

2. 使用示例

# if-elif-else语句示例# 分数评级score =85if score >=90:print("优秀")elif score >=80:print("良好")elif score >=70:print("中等")elif score >=60:print("及格")else:print("不及格")# 季节判断month =3if month in[12,1,2]:print("冬季")elif month in[3,4,5]:print("春季")elif month in[6,7,8]:print("夏季")elif month in[9,10,11]:print("秋季")else:print("月份无效")# 数字分类num =0if num >0:print("正数")elif num <0:print("负数")else:print("零")

3. 注意事项

  • 可以有任意数量的elif子句
  • elif
    子句必须在if子句之后,else子句之前
  • elif
    子句必须有条件表达式
  • 只有第一个条件为True的代码块会被执行
  • else
    子句是可选的

五、嵌套条件语句

1. 基本语法

嵌套条件语句是指在一个条件语句的代码块中包含另一个条件语句:

# 嵌套条件语句的基本语法if 条件表达式1:# 条件1为True时执行的代码块if 条件表达式2:# 条件1和2都为True时执行的代码块        代码1...else:# 条件1为True但条件2为False时执行的代码块        代码1...else:# 条件1为False时执行的代码块    代码1...

2. 使用示例

# 嵌套条件语句示例# 登录验证username ="admin"password ="123456"if username =="admin":if password =="123456":print("登录成功")else:print("密码错误")else:print("用户名错误")# 成绩等级和奖学金判断score =95if score >=90:print("优秀")if score >=95:print("获得一等奖学金")else:print("获得二等奖学金")elif score >=80:print("良好")if score >=85:print("获得三等奖学金")else:print("没有奖学金")# 嵌套的if-elif-elsenum =5if num >0:print("正数")if num %2==0:print("偶数")else:print("奇数")elif num <0:print("负数")if num %2==0:print("偶数")else:print("奇数")else:print("零")

3. 注意事项

  • 嵌套条件语句可以有任意多层
  • 嵌套的代码块必须使用正确的缩进
  • 过多的嵌套会使代码难以阅读,应尽量避免(通常不超过3层)
  • 可以使用逻辑运算符替代某些嵌套结构

六、条件表达式(三元操作符)

1. 基本语法

条件表达式(也称为三元操作符)是一种简洁的条件控制结构,用于在一行代码中实现简单的条件判断:

# 条件表达式的基本语法变量 = 值1if 条件表达式 else 值2

当条件表达式为True时,变量被赋值为值1;当条件表达式为False时,变量被赋值为值2。

2. 使用示例

# 条件表达式示例# 简单的条件赋值age =18status ="成年"if age >=18else"未成年"print(status)# 成年# 比较两个数的大小=5=10max_num = x if x > y else yprint(max_num)# 10# 判断奇偶性num =6result ="偶数"if num %2==0else"奇数"print(result)# 偶数# 结合其他表达式name ="张三"greeting =f"Hello, {name}"if name else"Hello, stranger"print(greeting)# Hello, 张三# 嵌套条件表达式score =85grade ="优秀"if score >=90else"良好"if score >=80else"中等"if score >=70else"及格"if score >=60else"不及格"print(grade)# 良好

3. 注意事项

  • 条件表达式适合简单的条件判断,复杂的条件判断应使用完整的条件语句
  • 过多的嵌套条件表达式会使代码难以阅读
  • 条件表达式的优先级较低,必要时应使用括号

七、逻辑运算符与条件语句

1. 逻辑运算符概述

Python提供了三种逻辑运算符:

  • and
    :逻辑与,当且仅当所有操作数都为True时返回True
  • or
    :逻辑或,当至少有一个操作数为True时返回True
  • not
    :逻辑非,返回操作数的相反布尔值

2. 短路求值

Python的逻辑运算符具有短路求值特性:

  • and
    :如果第一个操作数为False,则不计算第二个操作数
  • or
    :如果第一个操作数为True,则不计算第二个操作数

3. 使用示例

# 逻辑运算符示例# and运算符=5if x >0and x <10:print("x是0到10之间的正数")# or运算符fruit ="apple"if fruit =="apple"or fruit =="banana"or fruit =="orange":print("这是一种常见的水果")# not运算符name =""ifnot name:print("姓名为空")# 短路求值示例deffunc():print("函数被调用了")returnTrue# and的短路求值ifFalseand func():print("条件为True")# 输出:(func()不会被调用)# or的短路求值ifTrueor func():print("条件为True")# 输出:条件为True(func()不会被调用)# 复杂的逻辑表达式age =25is_student =Trueif age >=18and age <=30and(is_student ornot is_student):print("你是18到30岁之间的人")

4. 注意事项

  • 逻辑运算符的优先级:not > and > or
  • 必要时使用括号明确表达式的计算顺序
  • 避免过于复杂的逻辑表达式,影响代码可读性

八、比较运算符与条件语句

1. 比较运算符概述

Python提供了多种比较运算符:

  • ==
    :等于
  • !=
    :不等于
  • >
    :大于
  • <
    :小于
  • >=
    :大于等于
  • <=
    :小于等于
  • is
    :身份比较(判断是否为同一个对象)
  • is not
    :身份比较(判断是否不是同一个对象)

2. 使用示例

# 比较运算符示例# 数值比较=5=10if x == y:print("x等于y")elif x < y:print("x小于y")else:print("x大于y")# 字符串比较str1 ="apple"str2 ="banana"if str1 == str2:print("字符串相等")elif str1 < str2:# 按字典序比较print(f"{str1}在字典序中排在{str2}前面")else:print(f"{str1}在字典序中排在{str2}后面")# 身份比较=[1,2,3]=[1,2,3]= xif x is y:print("x和y是同一个对象")else:print("x和y不是同一个对象")if x is z:print("x和z是同一个对象")else:print("x和z不是同一个对象")# None比较value =Noneif value isNone:print("值为None")# 复合比较age =25if18<= age <=30:print("年龄在18到30岁之间")

3. 注意事项

  • 使用==比较值的相等性,使用is比较对象的身份
  • 避免在浮点数比较中使用==,由于浮点数的精度问题
  • Python支持链式比较(如a < b < c),等价于a < b and b < c

九、真值测试

1. 真值测试概述

在Python中,任何对象都可以进行真值测试,用于判断其是True还是False。以下对象在布尔上下文中被视为False:

  • None
  • False
  • 数字0(0, 0.0, 0j)
  • 空序列('', [], ())
  • 空映射({})
  • 空集合(set(), frozenset())
  • 自定义对象实现了__bool__()方法并返回False
  • 自定义对象实现了__len__()方法并返回0

其他所有对象都被视为True。

2. 使用示例

# 真值测试示例# None测试value =Noneifnot value:print("值为None")# 数字测试num1 =0num2 =5ifnot num1:print("num1为0")if num2:print("num2不为0")# 字符串测试str1 =""str2 ="hello"ifnot str1:print("字符串为空")if str2:print("字符串不为空")# 列表测试list1 =[]list2 =[1,2,3]ifnot list1:print("列表为空")if list2:print("列表不为空")# 字典测试dict1 ={}dict2 ={"name":"张三"}ifnot dict1:print("字典为空")if dict2:print("字典不为空")# 集合测试set1 =set()set2 ={1,2,3}ifnot set1:print("集合为空")if set2:print("集合不为空")# 自定义对象测试classMyClass:def__init__(self, value):        self.value = valuedef__bool__(self):return self.value >0obj1 = MyClass(0)obj2 = MyClass(5)ifnot obj1:print("obj1的value <= 0")if obj2:print("obj2的value > 0")

3. 注意事项

  • 利用真值测试可以使代码更简洁
  • 明确的比较(如if len(list1) == 0:)比真值测试(如if not list1:)更易读
  • 避免在可能产生混淆的地方使用真值测试

十、常见的条件控制模式

1. 多值判断

使用in运算符判断值是否在序列中:

# 多值判断示例# 判断星期几weekday ="Monday"if weekday in["Monday","Tuesday","Wednesday","Thursday","Friday"]:print("工作日")else:print("周末")# 判断颜色color ="red"if color in{"red","green","blue"}:print("三原色之一")else:print("不是三原色")# 判断季节month =7if month in(3,4,5):print("春季")elif month in(6,7,8):print("夏季")elif month in(9,10,11):print("秋季")elif month in(12,1,2):print("冬季")else:print("月份无效")

2. 范围判断

使用比较运算符判断值是否在某个范围内:

# 范围判断示例# 判断年龄age =25if0<= age <18:print("未成年人")elif18<= age <65:print("成年人")else:print("老年人")# 判断成绩score =75if score <60:print("不及格")elif60<= score <70:print("及格")elif70<= score <80:print("中等")elif80<= score <90:print("良好")else:print("优秀")# 判断时间hour =14if6<= hour <12:print("上午")elif12<= hour <18:print("下午")else:print("晚上")

3. 类型判断

使用isinstance()函数判断对象的类型:

# 类型判断示例defprocess_data(data):ifisinstance(data,str):print(f"处理字符串: {data}")elifisinstance(data,int):print(f"处理整数: {data}")elifisinstance(data,float):print(f"处理浮点数: {data}")elifisinstance(data,list):print(f"处理列表,长度为: {len(data)}")elifisinstance(data,dict):print(f"处理字典,键的数量为: {len(data)}")else:print(f"处理未知类型: {type(data).__name__}")# 测试不同类型的数据process_data("hello")# 处理字符串: helloprocess_data(123)# 处理整数: 123process_data(3.14)# 处理浮点数: 3.14process_data([1,2,3])# 处理列表,长度为: 3process_data({"name":"张三","age":25})# 处理字典,键的数量为: 2process_data(None)# 处理未知类型: NoneType

4. 异常处理与条件判断

结合try-except和条件判断处理可能的异常:

# 异常处理与条件判断示例defsafe_divide(a, b):if b ==0:print("除数不能为0")returnNonetry:return a / bexcept TypeError:print("参数必须是数字")returnNone# 测试函数result1 = safe_divide(10,2)print(result1)# 5.0result2 = safe_divide(10,0)print(result2)# Noneresult3 = safe_divide(10,"2")print(result3)# None

十一、条件控制的最佳实践

1. 代码可读性

  • 使用清晰的变量名和条件表达式
  • 保持代码块简洁,一个代码块只做一件事
  • 避免过多的嵌套(通常不超过3层)
  • 使用空行分隔不同的条件块

2. 条件表达式的简化

  • 使用in运算符替代多个or条件
  • 使用not in运算符替代多个and条件
  • 利用真值测试简化条件表达式
  • 使用条件表达式替代简单的if-else语句

3. 避免常见的陷阱

  • 避免使用=(赋值)代替==(比较)
  • 正确使用is==
  • 注意浮点数的比较问题
  • 避免过于复杂的逻辑表达式

4. 示例对比

# 不好的写法defis_weekday(day):if day =="Monday"or day =="Tuesday"or day =="Wednesday"or day =="Thursday"or day =="Friday":returnTrueelse:returnFalse# 好的写法defis_weekday(day):return day in["Monday","Tuesday","Wednesday","Thursday","Friday"]# 不好的写法iflen(list1)==0:print("列表为空")# 好的写法(但不够明确)ifnot list1:print("列表为空")# 更好的写法(明确)iflen(list1)==0:print("列表为空")# 不好的写法if a >0and a <10:print("a在0到10之间")# 好的写法if0< a <10:print("a在0到10之间")# 不好的写法ifnot(>0or y >0):print("x和y都不大于0")# 好的写法(德摩根定律)if x <=0and y <=0:print("x和y都不大于0")

十二、常见错误

1. 忘记冒号

# 错误:忘记冒号if x >0print("x是正数")# 正确:添加冒号if x >0:print("x是正数")

2. 缩进错误

# 错误:缩进不一致if x >0:print("x是正数")print("这行缩进不正确")# 正确:保持一致的缩进if x >0:print("x是正数")print("这行缩进正确")

3. 使用赋值运算符代替比较运算符

# 错误:使用赋值运算符if x =5:print("x等于5")# 正确:使用比较运算符if x ==5:print("x等于5")

4. 身份比较与值比较混淆

# 错误:使用is比较值=1000=1000if x is y:print("x和y相等")else:print("x和y不相等")# 输出:x和y不相等# 正确:使用==比较值if x == y:print("x和y相等")# 输出:x和y相等# 正确:使用is比较身份=[1,2,3]= xif x is y:print("x和y是同一个对象")# 输出:x和y是同一个对象

5. 浮点数比较问题

# 错误:直接比较浮点数=0.1+0.2=0.3if x == y:print("x等于y")else:print("x不等于y")# 输出:x不等于y# 正确:使用近似比较ifabs(- y)<1e-9:print("x近似等于y")# 输出:x近似等于y# 正确:使用decimal模块from decimal import Decimal= Decimal("0.1")+ Decimal("0.2")= Decimal("0.3")if x == y:print("x等于y")# 输出:x等于y

6. 逻辑运算符优先级问题

# 错误:未考虑逻辑运算符优先级ifnot x >0and y >0:print("x <= 0且y > 0")# 正确:使用括号明确优先级if(not x >0)and y >0:print("x <= 0且y > 0")# 或者改写为if x <=0and y >0:print("x <= 0且y > 0")

十三、总结

Python的条件控制语句是编程中实现逻辑判断的核心结构,主要包括:

  1. if语句
    :用于单一条件判断
  2. if-else语句
    :用于二选一的条件判断
  3. if-elif-else语句
    :用于多条件判断
  4. 嵌套条件语句
    :用于复杂的条件判断
  5. 条件表达式
    :用于简洁的条件赋值

在使用条件控制语句时,应注意:

  • 保持代码的可读性
  • 避免常见的错误(如忘记冒号、缩进错误等)
  • 合理使用逻辑运算符和比较运算符
  • 利用真值测试简化代码
  • 避免过多的嵌套

通过掌握Python的条件控制语句,可以编写出更灵活、更强大的程序逻辑。


发布网站:荣殿教程(zhangrongdian.com)

作者:张荣殿

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-03 12:23:52 HTTP/2.0 GET : https://f.mffb.com.cn/a/497177.html
  2. 运行时间 : 0.151175s [ 吞吐率:6.61req/s ] 内存消耗:5,096.59kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=3fba4c481fecdbf76b2168cbff6aacb9
  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.000629s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000766s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000350s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000284s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000507s ]
  6. SELECT * FROM `set` [ RunTime:0.000247s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000535s ]
  8. SELECT * FROM `article` WHERE `id` = 497177 LIMIT 1 [ RunTime:0.000669s ]
  9. UPDATE `article` SET `lasttime` = 1783052632 WHERE `id` = 497177 [ RunTime:0.027336s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000336s ]
  11. SELECT * FROM `article` WHERE `id` < 497177 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000801s ]
  12. SELECT * FROM `article` WHERE `id` > 497177 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000531s ]
  13. SELECT * FROM `article` WHERE `id` < 497177 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.000911s ]
  14. SELECT * FROM `article` WHERE `id` < 497177 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.033024s ]
  15. SELECT * FROM `article` WHERE `id` < 497177 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.010949s ]
0.152868s