当前位置:首页>python>Python循环语句详解

Python循环语句详解

  • 2026-07-02 06:47:36
Python循环语句详解

循环语句是Python编程中用于重复执行一段代码的核心结构。Python提供了多种循环语句,主要包括for循环和while循环。本文将详细介绍Python循环语句的特性、用法和最佳实践。

一、循环概述

1. 什么是循环?

循环是编程语言中用于重复执行一段代码块的结构。当需要多次执行相同或相似的操作时,可以使用循环语句来简化代码,提高效率。

2. Python的循环类型

Python主要提供两种循环类型:

  • for循环
    :用于遍历序列(如列表、元组、字符串)或可迭代对象
  • while循环
    :当条件为True时重复执行代码块

3. 循环的基本原理

循环的基本原理是:

  1. 检查循环条件(for循环的可迭代对象是否还有元素,while循环的条件表达式是否为True)
  2. 如果条件满足,执行循环体中的代码块
  3. 更新循环状态(for循环移动到下一个元素,while循环可能需要手动更新条件)
  4. 重复步骤1-3,直到条件不满足

二、for循环

1. 基本语法

for循环用于遍历序列或可迭代对象,基本语法如下:

# for循环的基本语法
for 变量 in 可迭代对象:
# 循环体代码块
    代码1
    代码2
...

其中,可迭代对象包括列表、元组、字符串、range对象、字典、集合等。

2. 遍历序列

遍历列表

# 遍历列表示例
fruits =["apple","banana","orange","grape"]

for fruit in fruits:
print(fruit)

# 输出:
# apple
# banana
# orange
# grape

遍历元组

# 遍历元组示例
numbers =(1,2,3,4,5)

sum=0
for num in numbers:
sum+= num

print(f"总和为: {sum}")# 输出:总和为: 15

遍历字符串

# 遍历字符串示例
word ="python"

for char in word:
print(char, end=" ")# 输出:p y t h o n

遍历range对象

range()函数用于生成一个整数序列,常用于for循环中控制循环次数:

# 遍历range对象示例

# range(5) 生成 0, 1, 2, 3, 4
for i inrange(5):
print(i)

# range(1, 6) 生成 1, 2, 3, 4, 5
for i inrange(1,6):
print(i)

# range(1, 10, 2) 生成 1, 3, 5, 7, 9
for i inrange(1,10,2):
print(i)

# range(5, 0, -1) 生成 5, 4, 3, 2, 1
for i inrange(5,0,-1):
print(i)

3. 遍历字典

遍历字典可以通过keys()values()items()方法:

# 遍历字典示例
person ={
"name":"张三",
"age":30,
"city":"北京",
"email":"zhangsan@example.com"
}

# 遍历字典的键
print("遍历字典的键:")
for key in person:
print(key)

# 或者使用keys()方法
for key in person.keys():
print(key)

# 遍历字典的值
print("\n遍历字典的值:")
for value in person.values():
print(value)

# 遍历字典的键值对
print("\n遍历字典的键值对:")
for key, value in person.items():
print(f"{key}{value}")

4. 遍历集合

# 遍历集合示例
colors ={"red","green","blue","yellow"}

for color in colors:
print(color)

# 注意:集合是无序的,每次遍历的顺序可能不同

5. 嵌套for循环

嵌套for循环是指在一个for循环的循环体中包含另一个for循环:

# 嵌套for循环示例

# 打印乘法表
for i inrange(1,10):
for j inrange(1, i +1):
print(f"{j}×{i}={* j}", end="\t")
print()# 换行

# 输出:
# 1×1=1
# 1×2=2    2×2=4
# 1×3=3    2×3=6    3×3=9
# ...

# 遍历二维列表
matrix =[[1,2,3],[4,5,6],[7,8,9]]

for row in matrix:
for num in row:
print(num, end=" ")
print()

# 输出:
# 1 2 3
# 4 5 6
# 7 8 9

三、while循环

1. 基本语法

while循环当条件为True时重复执行代码块,基本语法如下:

# while循环的基本语法
while 条件表达式:
# 循环体代码块
    代码1
    代码2
...
# 更新条件(避免无限循环)
    更新语句

2. 使用示例

# while循环示例

# 打印1到5的数字
count =1
while count <=5:
print(count)
    count +=1# 更新条件,避免无限循环

# 输出:
# 1
# 2
# 3
# 4
# 5

# 计算1到100的和
sum=0
num =1
while num <=100:
sum+= num
    num +=1

print(f"1到100的和为: {sum}")# 输出:1到100的和为: 5050

# 猜数字游戏
import random

secret_number = random.randint(1,100)
guess =0
attempts =0

while guess != secret_number:
    guess =int(input("请输入你猜测的数字(1-100): "))
    attempts +=1
if guess < secret_number:
print("猜小了")
elif guess > secret_number:
print("猜大了")
else:
print(f"恭喜你,猜对了!你共尝试了{attempts}次")

3. 无限循环

当while循环的条件始终为True时,会导致无限循环。在某些情况下,这是有意为之的,但通常应该避免:

# 无限循环示例

# 有意的无限循环(需要用户中断)
whileTrue:
    user_input =input("请输入内容(输入'quit'退出): ")
if user_input =="quit":
break
print(f"你输入的内容是: {user_input}")

# 无意的无限循环(错误)
count =1
while count <=5:
print(count)
# 缺少count += 1,导致无限循环

4. 嵌套while循环

嵌套while循环是指在一个while循环的循环体中包含另一个while循环:

# 嵌套while循环示例

# 打印星号三角形
row =1
while row <=5:
    col =1
while col <= row:
print("*")
        col +=1
print()# 换行
    row +=1

# 输出:
# *
# **
# ***
# ****
# *****

# 寻找两个数的最大公约数
=int(input("请输入第一个数: "))
=int(input("请输入第二个数: "))

while b !=0:
    temp = a % b
while temp !=0:
        a = b
        b = temp
        temp = a % b
print(f"最大公约数为: {if b !=0else a}")
break

四、循环控制语句

1. break语句

break语句用于终止当前循环,跳出循环体:

# break语句示例

# 在for循环中使用break
fruits =["apple","banana","orange","grape"]

for fruit in fruits:
if fruit =="orange":
print("找到橙子了")
break
print(fruit)

# 输出:
# apple
# banana
# 找到橙子了

# 在while循环中使用break
count =1
whileTrue:
print(count)
if count ==5:
break
    count +=1

# 输出:
# 1
# 2
# 3
# 4
# 5

# 在嵌套循环中使用break(只终止内层循环)
for i inrange(1,4):
print(f"外层循环: {i}")
for j inrange(1,4):
if j ==2:
break
print(f"内层循环: {j}")

# 输出:
# 外层循环: 1
# 内层循环: 1
# 外层循环: 2
# 内层循环: 1
# 外层循环: 3
# 内层循环: 1

2. continue语句

continue语句用于跳过当前循环的剩余部分,直接进入下一次循环:

# continue语句示例

# 在for循环中使用continue
numbers =[1,2,3,4,5,6,7,8,9,10]

for num in numbers:
if num %2==0:
continue# 跳过偶数
print(num)# 只打印奇数

# 输出:
# 1
# 3
# 5
# 7
# 9

# 在while循环中使用continue
count =0
while count <10:
    count +=1
if count %2==0:
continue# 跳过偶数
print(count)# 只打印奇数

# 输出:
# 1
# 3
# 5
# 7
# 9

# 处理用户输入
whileTrue:
    user_input =input("请输入数字(输入'quit'退出): ")
if user_input =="quit":
break
ifnot user_input.isdigit():
print("请输入有效的数字")
continue
print(f"你输入的数字是: {user_input}")

3. pass语句

pass语句是一个空操作,不执行任何操作,主要用于占位:

# pass语句示例

# 在for循环中使用pass
for i inrange(5):
pass# 暂时不实现,占位用

# 在while循环中使用pass
count =0
while count <5:
pass# 暂时不实现,占位用
    count +=1

# 在条件语句中使用pass
age =18
if age >=18:
pass# 暂时不实现成年后的逻辑
else:
print("未成年")

# 在函数中使用pass
defmy_function():
pass# 暂时不实现函数体

# 在类中使用pass
classMyClass:
pass# 暂时不实现类的内容

4. else子句

Python的循环语句可以带有else子句,当循环正常结束时(即没有被break语句终止),会执行else子句中的代码:

# else子句示例

# 在for循环中使用else
for i inrange(5):
print(i)
else:
print("循环正常结束")

# 输出:
# 0
# 1
# 2
# 3
# 4
# 循环正常结束

# 在for循环中使用break,else子句不会执行
for i inrange(5):
if i ==3:
break
print(i)
else:
print("循环正常结束")

# 输出:
# 0
# 1
# 2

# 在while循环中使用else
count =1
while count <=5:
print(count)
    count +=1
else:
print("循环正常结束")

# 输出:
# 1
# 2
# 3
# 4
# 5
# 循环正常结束

# 在while循环中使用break,else子句不会执行
count =1
while count <=5:
if count ==3:
break
print(count)
    count +=1
else:
print("循环正常结束")

# 输出:
# 1
# 2

# 使用else子句检查素数
defis_prime(num):
if num <=1:
returnFalse
for i inrange(2,int(num **0.5)+1):
if num % i ==0:
returnFalse
else:
# 循环正常结束,说明num是素数
returnTrue

print(is_prime(7))# True
print(is_prime(12))# False

五、循环的高级特性

1. 列表推导式

列表推导式是一种简洁创建列表的方法,可以替代简单的for循环:

# 列表推导式示例

# 基本列表推导式
# 传统方法
numbers =[]
for i inrange(1,6):
    numbers.append(i)
print(numbers)# [1, 2, 3, 4, 5]

# 列表推导式
numbers =[for i inrange(1,6)]
print(numbers)# [1, 2, 3, 4, 5]

# 带有条件的列表推导式
# 传统方法
evens =[]
for i inrange(1,11):
if i %2==0:
        evens.append(i)
print(evens)# [2, 4, 6, 8, 10]

# 列表推导式
evens =[for i inrange(1,11)if i %2==0]
print(evens)# [2, 4, 6, 8, 10]

# 嵌套列表推导式
# 传统方法
matrix =[[1,2,3],[4,5,6],[7,8,9]]
flattened =[]
for row in matrix:
for num in row:
        flattened.append(num)
print(flattened)# [1, 2, 3, 4, 5, 6, 7, 8, 9]

# 列表推导式
flattened =[num for row in matrix for num in row]
print(flattened)# [1, 2, 3, 4, 5, 6, 7, 8, 9]

# 带有条件的嵌套列表推导式
# 传统方法
squares =[]
for i inrange(1,11):
if i %2==0:
        squares.append(**2)
print(squares)# [4, 16, 36, 64, 100]

# 列表推导式
squares =[**2for i inrange(1,11)if i %2==0]
print(squares)# [4, 16, 36, 64, 100]

2. 字典推导式

字典推导式是一种简洁创建字典的方法:

# 字典推导式示例

# 基本字典推导式
# 传统方法
squares ={}
for i inrange(1,6):
    squares[i]= i **2
print(squares)# {1: 1, 2: 4, 3: 9, 4: 16, 5: 25}

# 字典推导式
squares ={i: i **2for i inrange(1,6)}
print(squares)# {1: 1, 2: 4, 3: 9, 4: 16, 5: 25}

# 带有条件的字典推导式
# 传统方法
even_squares ={}
for i inrange(1,11):
if i %2==0:
        even_squares[i]= i **2
print(even_squares)# {2: 4, 4: 16, 6: 36, 8: 64, 10: 100}

# 字典推导式
even_squares ={i: i **2for i inrange(1,11)if i %2==0}
print(even_squares)# {2: 4, 4: 16, 6: 36, 8: 64, 10: 100}

# 从两个列表创建字典
# 传统方法
keys =["name","age","city"]
values =["张三",30,"北京"]
person ={}
for k, v inzip(keys, values):
    person[k]= v
print(person)# {'name': '张三', 'age': 30, 'city': '北京'}

# 字典推导式
person ={k: v for k, v inzip(keys, values)}
print(person)# {'name': '张三', 'age': 30, 'city': '北京'}

# 转换字典的键值对
# 传统方法
original ={"a":1,"b":2,"c":3}
reversed_dict ={}
for k, v in original.items():
    reversed_dict[v]= k
print(reversed_dict)# {1: 'a', 2: 'b', 3: 'c'}

# 字典推导式
reversed_dict ={v: k for k, v in original.items()}
print(reversed_dict)# {1: 'a', 2: 'b', 3: 'c'}

3. 集合推导式

集合推导式是一种简洁创建集合的方法:

# 集合推导式示例

# 基本集合推导式
# 传统方法
squares =set()
for i inrange(1,6):
    squares.add(**2)
print(squares)# {1, 4, 9, 16, 25}

# 集合推导式
squares ={**2for i inrange(1,6)}
print(squares)# {1, 4, 9, 16, 25}

# 带有条件的集合推导式
# 传统方法
even_squares =set()
for i inrange(1,11):
if i %2==0:
        even_squares.add(**2)
print(even_squares)# {4, 16, 36, 64, 100}

# 集合推导式
even_squares ={**2for i inrange(1,11)if i %2==0}
print(even_squares)# {4, 16, 36, 64, 100}

# 从字符串创建集合(去重)
# 传统方法
word ="hello"
unique_chars =set()
for char in word:
    unique_chars.add(char)
print(unique_chars)# {'h', 'e', 'l', 'o'}

# 集合推导式
unique_chars ={char for char in word}
print(unique_chars)# {'h', 'e', 'l', 'o'}

# 嵌套集合推导式
# 传统方法
matrix =[[1,2,3],[4,5,6],[7,8,9]]
unique_nums =set()
for row in matrix:
for num in row:
        unique_nums.add(num)
print(unique_nums)# {1, 2, 3, 4, 5, 6, 7, 8, 9}

# 集合推导式
unique_nums ={num for row in matrix for num in row}
print(unique_nums)# {1, 2, 3, 4, 5, 6, 7, 8, 9}

4. 生成器表达式

生成器表达式是一种简洁创建生成器的方法,与列表推导式类似,但使用圆括号:

# 生成器表达式示例

# 基本生成器表达式
# 列表推导式(创建完整列表)
squares_list =[**2for i inrange(1,6)]
print(squares_list)# [1, 4, 9, 16, 25]
print(type(squares_list))# <class 'list'>

# 生成器表达式(创建生成器)
squares_gen =(**2for i inrange(1,6))
print(squares_gen)# <generator object <genexpr> at 0x...>
print(type(squares_gen))# <class 'generator'>

# 遍历生成器
for square in squares_gen:
print(square)
# 输出:
# 1
# 4
# 9
# 16
# 25

# 带有条件的生成器表达式
# 传统方法
even_gen =(for i inrange(1,11)if i %2==0)
for num in even_gen:
print(num)
# 输出:
# 2
# 4
# 6
# 8
# 10

# 生成器表达式的优势(节省内存)
import sys

# 列表推导式占用的内存
list_comp =[for i inrange(1000000)]
print(f"列表推导式占用内存: {sys.getsizeof(list_comp)} 字节")

# 生成器表达式占用的内存
gen_expr =(for i inrange(1000000))
print(f"生成器表达式占用内存: {sys.getsizeof(gen_expr)} 字节")

# 处理大文件
defread_large_file(file_path):
withopen(file_path,'r')asfile:
        lines =(line.strip()for line infile)# 生成器表达式
for line in lines:
yield line

# 遍历生成器
# for line in read_large_file('large_file.txt'):
#     process_line(line)

六、循环的性能分析

1. 时间复杂度

循环的时间复杂度主要取决于循环体的执行次数:

循环类型
时间复杂度
描述
简单for循环
O(n)
遍历n个元素
嵌套for循环
O(n*m)
外层循环n次,内层循环m次
while循环(固定次数)
O(n)
执行n次循环体
while循环(条件满足概率递减)
O(log n)
如二分查找
无限循环
O(∞)
永远执行

2. 性能优化建议

  • 优先使用内置函数和方法,它们通常是用C实现的,比Python代码快
  • 避免在循环体中执行耗时操作
  • 减少循环体内的函数调用次数
  • 使用局部变量代替全局变量,局部变量的访问速度更快
  • 对于大型数据集,使用生成器表达式代替列表推导式,节省内存
  • 避免在循环中重复计算不变的值

3. 性能比较示例

# 性能比较示例

import time

# 使用for循环和append()方法
start_time = time.time()
result =[]
for i inrange(1000000):
    result.append(i)
end_time = time.time()
print(f"for循环和append(): {end_time - start_time:.6f}秒")

# 使用列表推导式
start_time = time.time()
result =[for i inrange(1000000)]
end_time = time.time()
print(f"列表推导式: {end_time - start_time:.6f}秒")

# 使用range()直接转换为列表
start_time = time.time()
result =list(range(1000000))
end_time = time.time()
print(f"list(range()): {end_time - start_time:.6f}秒")

# 内置函数vs自定义函数
defsquare(n):
return n **2

start_time = time.time()
result =[square(i)for i inrange(1000000)]
end_time = time.time()
print(f"自定义函数: {end_time - start_time:.6f}秒")

start_time = time.time()
result =[**2for i inrange(1000000)]
end_time = time.time()
print(f"内置运算符: {end_time - start_time:.6f}秒")

七、循环的最佳实践

1. 代码可读性

  • 使用有意义的变量名
  • 保持循环体简洁,一个循环只做一件事
  • 避免过多的嵌套(通常不超过3层)
  • 使用空行分隔不同的代码块
  • 添加注释说明循环的目的

2. 避免常见的错误

  • 避免无限循环,确保循环条件会最终变为False
  • 避免在循环中修改正在遍历的序列
  • 确保循环变量在循环结束后不会被意外使用
  • 避免在循环中重复计算不变的值

3. 示例对比

# 不好的写法
defcalculate_sum(numbers):
    total =0
for i inrange(len(numbers)):
        total += numbers[i]
return total

# 好的写法
defcalculate_sum(numbers):
    total =0
for num in numbers:
        total += num
return total

# 更好的写法
defcalculate_sum(numbers):
returnsum(numbers)

# 不好的写法
result =[]
for i inrange(10):
if i %2==0:
        result.append(*2)

# 好的写法
result =[*2for i inrange(10)if i %2==0]

# 不好的写法
for i inrange(len(fruits)):
if fruits[i]=="apple":
print("找到苹果了")
break

# 好的写法
for fruit in fruits:
if fruit =="apple":
print("找到苹果了")
break

八、常见错误

1. 无限循环

# 无限循环示例

# 错误:缺少循环变量的更新
count =1
while count <=5:
print(count)
# 缺少count += 1,导致无限循环

# 错误:条件永远为True
whileTrue:
print("无限循环")
# 缺少break语句,导致无限循环

# 正确的写法
count =1
while count <=5:
print(count)
    count +=1# 更新循环变量

whileTrue:
    user_input =input("请输入内容(输入'quit'退出): ")
if user_input =="quit":
break# 提供退出条件
print(f"你输入的内容是: {user_input}")

2. 循环条件错误

# 循环条件错误示例

# 错误:使用赋值运算符代替比较运算符
count =1
while count =5:# 错误,应该使用==
print(count)
    count +=1

# 错误:条件表达式错误
numbers =[1,2,3,4,5]
for i in numbers:
if i >10# 缺少冒号
break
print(i)

# 正确的写法
count =1
while count ==5:# 使用==
print(count)
    count +=1

for i in numbers:
if i >10:# 添加冒号
break
print(i)

3. 索引错误

# 索引错误示例

# 错误:索引超出范围
numbers =[1,2,3,4,5]
for i inrange(6):# 错误,列表只有5个元素,索引0-4
print(numbers[i])

# 错误:修改正在遍历的列表
numbers =[1,2,3,4,5]
for i in numbers:
if i ==3:
        numbers.remove(i)# 修改正在遍历的列表,可能导致不可预期的结果
print(i)

# 正确的写法
numbers =[1,2,3,4,5]
for i inrange(len(numbers)):
if i <5:# 确保索引不超出范围
print(numbers[i])

# 或者直接遍历列表
for num in numbers:
print(num)

# 修改列表的正确方法
numbers =[1,2,3,4,5]
# 创建一个新列表
new_numbers =[for i in numbers if i !=3]
print(new_numbers)# [1, 2, 4, 5]

4. 变量作用域问题

# 变量作用域问题示例

# 错误:在循环体外使用循环变量
for i inrange(5):
print(i)
print(f"循环结束后的i值: {i}")# 在Python中这是允许的,但不推荐

# 错误:在嵌套循环中使用相同的变量名
for i inrange(3):
print(f"外层循环i: {i}")
for i inrange(2):
print(f"内层循环i: {i}")
print(f"外层循环i: {i}")# 内层循环修改了外层循环的变量i

# 正确的写法
# 使用不同的变量名
=None# 在循环外初始化变量
for i inrange(5):
print(i)
print(f"循环结束后的i值: {i}")

# 在嵌套循环中使用不同的变量名
for i inrange(3):
print(f"外层循环i: {i}")
for j inrange(2):
print(f"内层循环j: {j}")
print(f"外层循环i: {i}")# i的值保持不变

九、总结

Python的循环语句是编程中实现重复操作的核心结构,主要包括:

  1. for循环:用于遍历序列或可迭代对象

    • 遍历列表、元组、字符串、range对象
    • 遍历字典、集合
    • 嵌套for循环
  2. while循环:当条件为True时重复执行代码块

    • 基本语法
    • 无限循环
    • 嵌套while循环
  3. 循环控制语句

    • break语句:终止循环
    • continue语句:跳过当前循环的剩余部分
    • pass语句:占位用,不执行任何操作
    • else子句:循环正常结束时执行
  4. 循环的高级特性

    • 列表推导式:简洁创建列表
    • 字典推导式:简洁创建字典
    • 集合推导式:简洁创建集合
    • 生成器表达式:节省内存的生成器创建方法
  5. 循环的性能分析

    • 时间复杂度
    • 性能优化建议
  6. 循环的最佳实践

    • 代码可读性的提升
    • 避免常见的错误

在使用循环语句时,应注意:

  • 保持代码的可读性
  • 避免无限循环
  • 确保循环条件正确
  • 避免索引错误
  • 合理使用循环控制语句
  • 利用高级特性简化代码

通过掌握Python的循环语句,可以编写出更高效、更灵活的程序。


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

作者:张荣殿

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-03 12:19:09 HTTP/2.0 GET : https://f.mffb.com.cn/a/497174.html
  2. 运行时间 : 0.102591s [ 吞吐率:9.75req/s ] 内存消耗:4,811.12kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=30170de14a7ec43db9b07d42c590d08b
  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.000602s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000833s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000330s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000261s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000525s ]
  6. SELECT * FROM `set` [ RunTime:0.000196s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000837s ]
  8. SELECT * FROM `article` WHERE `id` = 497174 LIMIT 1 [ RunTime:0.006730s ]
  9. UPDATE `article` SET `lasttime` = 1783052349 WHERE `id` = 497174 [ RunTime:0.014906s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000260s ]
  11. SELECT * FROM `article` WHERE `id` < 497174 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000562s ]
  12. SELECT * FROM `article` WHERE `id` > 497174 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000490s ]
  13. SELECT * FROM `article` WHERE `id` < 497174 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.000708s ]
  14. SELECT * FROM `article` WHERE `id` < 497174 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.007982s ]
  15. SELECT * FROM `article` WHERE `id` < 497174 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.001273s ]
0.104197s