当前位置:首页>python>Python数据类型转换详解

Python数据类型转换详解

  • 2026-01-20 18:44:14
Python数据类型转换详解

Python数据类型转换详解

在Python编程中,经常需要将一种数据类型转换为另一种数据类型。数据类型转换可以是隐式的(自动发生)或显式的(使用转换函数)。本文将详细介绍Python中的数据类型转换。

一、数据类型转换概述

1. 什么是数据类型转换?

数据类型转换是指将一个数据类型的值转换为另一个数据类型的值的过程。例如,将整数转换为字符串,将列表转换为元组等。

2. 隐式转换 vs 显式转换

(1) 隐式转换(自动转换)

隐式转换是指Python解释器自动进行的数据类型转换,不需要程序员显式调用转换函数。

# 整数和浮点数相加,整数自动转换为浮点数=10# 整数=3.14# 浮点数result = x + yprint(result)# 13.14print(type(result))# <class 'float'># 布尔值和整数相加,布尔值自动转换为整数True=1False=0=True=5result = a + bprint(result)# 6print(type(result))# <class 'int'>

(2) 显式转换(强制转换)

显式转换是指程序员使用Python内置的转换函数手动进行的数据类型转换。

# 将浮点数转换为整数=3.14=int(y)print(x)# 3print(type(x))# <class 'int'># 将整数转换为字符串num =100str_num =str(num)print(str_num)# "100"print(type(str_num))# <class 'str'>

二、常用的类型转换函数

Python提供了一系列内置函数用于数据类型转换:

函数
描述
int()
将对象转换为整数
float()
将对象转换为浮点数
complex()
将对象转换为复数
str()
将对象转换为字符串
repr()
将对象转换为表示形式字符串
bool()
将对象转换为布尔值
list()
将对象转换为列表
tuple()
将对象转换为元组
set()
将对象转换为集合
dict()
将对象转换为字典
bytes()
将对象转换为字节序列
bytearray()
将对象转换为字节数组
memoryview()
创建对象的内存视图

三、数字类型转换

1. 整数转换

(1) int()函数

int()函数用于将对象转换为整数类型。

语法:int(x=0, base=10)

  • x
    :要转换的对象(可选,默认为0)
  • base
    :进制基数(可选,默认为10)
# 将浮点数转换为整数(截断小数部分)print(int(3.14))# 3print(int(-2.71))# -2# 将字符串转换为整数print(int("123"))# 123print(int("-456"))# -456# 指定进制转换print(int("1010",2))# 10(二进制转十进制)print(int("0xA",16))# 10(十六进制转十进制)print(int("12",8))# 10(八进制转十进制)# 布尔值转换为整数print(int(True))# 1print(int(False))# 0# 无参数时返回0print(int())# 0

2. 浮点数转换

(1) float()函数

float()函数用于将对象转换为浮点数类型。

语法:float(x=0.0)

  • x
    :要转换的对象(可选,默认为0.0)
# 将整数转换为浮点数print(float(10))# 10.0print(float(-5))# -5.0# 将字符串转换为浮点数print(float("3.14"))# 3.14print(float("-2.718"))# -2.718print(float("1e3"))# 1000.0print(float("-1.23e-4"))# -0.000123# 布尔值转换为浮点数print(float(True))# 1.0print(float(False))# 0.0# 无参数时返回0.0print(float())# 0.0

3. 复数转换

(1) complex()函数

complex()函数用于将对象转换为复数类型。

语法:complex(real=0, imag=0)

  • real
    :复数的实部(可选,默认为0)
  • imag
    :复数的虚部(可选,默认为0)
# 创建复数print(complex(1,2))# (1+2j)print(complex(3))# (3+0j)print(complex(0,4))# 4j# 将字符串转换为复数print(complex("1+2j"))# (1+2j)print(complex("3"))# (3+0j)print(complex("4j"))# 4j# 无参数时返回0jprint(complex())# 0j

四、字符串类型转换

1. 字符串转换

(1) str()函数

str()函数用于将对象转换为字符串类型。

语法:str(object= '')

  • object
    :要转换的对象(可选,默认为空字符串)
# 将整数转换为字符串print(str(123))# "123"print(str(-456))# "-456"# 将浮点数转换为字符串print(str(3.14))# "3.14"print(str(1.23e-4))# "0.000123"# 将布尔值转换为字符串print(str(True))# "True"print(str(False))# "False"# 将列表转换为字符串print(str([1,2,3]))# "[1, 2, 3]"# 将字典转换为字符串print(str({"name":"Python","version":3.12}))# "{'name': 'Python', 'version': 3.12}"# 将None转换为字符串print(str(None))# "None"

(2) repr()函数

repr()函数返回一个对象的官方字符串表示形式,通常可以使用eval()函数将其转换回原始对象。

# repr() vs str()="Hello, World!"print(str(x))# Hello, World!print(repr(x))# 'Hello, World!'# repr()返回的字符串可以使用eval()转换回原始对象=repr(x)print(eval(y))# Hello, World!# 数字类型的repr()和str()结果相同num =123print(str(num))# "123"print(repr(num))# "123"

五、布尔类型转换

1. 布尔值转换

(1) bool()函数

bool()函数用于将对象转换为布尔值类型。

语法:bool([x])

  • x
    :要转换的对象(可选,默认为False)

Python中,以下值会被转换为False:

  • 数字:0, 0.0, 0j(复数零)
  • 字符串:""(空字符串)
  • 序列:[], (), set()(空列表、空元组、空集合)
  • 映射:{}(空字典)
  • None

其他所有值都会被转换为True。

# 转换为False的值print(bool(0))# Falseprint(bool(0.0))# Falseprint(bool(0j))# Falseprint(bool(""))# Falseprint(bool([]))# Falseprint(bool(()))# Falseprint(bool(set()))# Falseprint(bool({}))# Falseprint(bool(None))# False# 转换为True的值print(bool(1))# Trueprint(bool(3.14))# Trueprint(bool("Hello"))# Trueprint(bool([1,2,3]))# Trueprint(bool((1,2,3)))# Trueprint(bool({1,2,3}))# Trueprint(bool({"name":"Python"}))# Trueprint(bool("False"))# True(非空字符串)

六、序列类型转换

1. 列表转换

(1) list()函数

list()函数用于将可迭代对象转换为列表类型。

语法:list([iterable])

  • iterable
    :可迭代对象(可选,默认为空列表)
# 将元组转换为列表print(list((1,2,3,4,5)))# [1, 2, 3, 4, 5]# 将集合转换为列表print(list({"apple","banana","orange"}))# ['apple', 'banana', 'orange'](顺序可能不同)# 将字典转换为列表(只包含键)print(list({"name":"Python","version":3.12}))# ['name', 'version']# 将字符串转换为列表print(list("Python"))# ['P', 'y', 't', 'h', 'o', 'n']# 将range对象转换为列表print(list(range(10)))# [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]# 无参数时返回空列表print(list())# []

2. 元组转换

(1) tuple()函数

tuple()函数用于将可迭代对象转换为元组类型。

语法:tuple([iterable])

  • iterable
    :可迭代对象(可选,默认为空元组)
# 将列表转换为元组print(tuple([1,2,3,4,5]))# (1, 2, 3, 4, 5)# 将集合转换为元组print(tuple({"apple","banana","orange"}))# ('apple', 'banana', 'orange')(顺序可能不同)# 将字典转换为元组(只包含键)print(tuple({"name":"Python","version":3.12}))# ('name', 'version')# 将字符串转换为元组print(tuple("Python"))# ('P', 'y', 't', 'h', 'o', 'n')# 将range对象转换为元组print(tuple(range(10)))# (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)# 无参数时返回空元组print(tuple())# ()

3. 集合转换

(1) set()函数

set()函数用于将可迭代对象转换为集合类型。集合会自动去重且元素无序。

语法:set([iterable])

  • iterable
    :可迭代对象(可选,默认为空集合)
# 将列表转换为集合(自动去重)print(set([1,2,2,3,4,4,5]))# {1, 2, 3, 4, 5}# 将元组转换为集合print(set((1,2,3,4,5)))# {1, 2, 3, 4, 5}# 将字典转换为集合(只包含键)print(set({"name":"Python","version":3.12}))# {'name', 'version'}# 将字符串转换为集合print(set("Python"))# {'P', 'y', 't', 'h', 'o', 'n'}# 将range对象转换为集合print(set(range(10)))# {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}# 无参数时返回空集合print(set())# set()

七、映射类型转换

1. 字典转换

(1) dict()函数

dict()函数用于将对象转换为字典类型。

语法:dict(**kwarg)dict(mapping, **kwarg)dict(iterable, **kwarg)

  • **kwarg
    :关键字参数
  • mapping
    :映射对象
  • iterable
    :可迭代对象,其中每个元素是键值对
# 使用关键字参数创建字典print(dict(name="Python", version=3.12))# {'name': 'Python', 'version': 3.12}# 使用映射对象创建字典fromkeys方法创建的字典keys =["name","version","author"]=dict.fromkeys(keys)print(d)# {'name': None, 'version': None, 'author': None}# 使用可迭代对象创建字典# 列表中的每个元素是一个包含两个元素的序列(键值对)pairs =[("name","Python"),("version",3.12)]print(dict(pairs))# {'name': 'Python', 'version': 3.12}# 使用zip函数创建字典keys =["name","version","author"]values =["Python",3.12,"Guido van Rossum"]print(dict(zip(keys, values)))# {'name': 'Python', 'version': 3.12, 'author': 'Guido van Rossum'}# 无参数时返回空字典print(dict())# {}

八、其他类型转换

1. 字节序列转换

(1) bytes()函数

bytes()函数用于将对象转换为不可变的字节序列。

语法:bytes([source[, encoding[, errors]]])

# 将字符串转换为字节序列(需要指定编码)print(bytes("Hello","utf-8"))# b'Hello'# 将整数转换为指定长度的字节序列print(bytes(5))# b'\x00\x00\x00\x00\x00'(5个空字节)# 将可迭代对象转换为字节序列print(bytes([65,66,67]))# b'ABC'(ASCII码)

(2) bytearray()函数

bytearray()函数用于将对象转换为可变的字节数组。

语法:bytearray([source[, encoding[, errors]]])

# 将字符串转换为字节数组ba =bytearray("Hello","utf-8")print(ba)# bytearray(b'Hello')# 字节数组是可变的ba[0]=104# 'h'的ASCII码print(ba)# bytearray(b'hello')# 将整数转换为字节数组print(bytearray(5))# bytearray(b'\x00\x00\x00\x00\x00')

2. 内存视图转换

(1) memoryview()函数

memoryview()函数用于创建对象的内存视图,可以直接访问对象的内存缓冲区。

语法:memoryview(obj)

# 创建字节对象的内存视图ba =bytearray("Hello","utf-8")mv =memoryview(ba)# 修改内存视图会影响原始对象mv[0]=104# 'h'的ASCII码print(ba)# bytearray(b'hello')# 内存视图支持切片print(mv[1:4])# <memory at 0x...>print(mv[1:4].tobytes())# b'ell'

九、常见的类型转换组合

1. 数字与字符串之间的转换

# 数字转字符串num =123str_num =str(num)print(str_num,type(str_num))# "123" <class 'str'># 字符串转数字str_num ="123"num =int(str_num)print(num,type(num))# 123 <class 'int'>str_float ="3.14"float_num =float(str_float)print(float_num,type(float_num))# 3.14 <class 'float'>

2. 列表、元组、集合之间的转换

# 列表转元组lst =[1,2,3,4,5]tpl =tuple(lst)print(tpl,type(tpl))# (1, 2, 3, 4, 5) <class 'tuple'># 元组转列表tpl =(1,2,3,4,5)lst =list(tpl)print(lst,type(lst))# [1, 2, 3, 4, 5] <class 'list'># 列表转集合(去重)lst =[1,2,2,3,4,4,5]=set(lst)print(s,type(s))# {1, 2, 3, 4, 5} <class 'set'># 集合转列表={1,2,3,4,5}lst =list(s)print(lst,type(lst))# [1, 2, 3, 4, 5] <class 'list'>

3. 字符串与列表之间的转换

# 字符串转列表str1 ="Hello"lst1 =list(str1)print(lst1,type(lst1))# ['H', 'e', 'l', 'l', 'o'] <class 'list'># 使用split()方法分割字符串str2 ="Hello,World,Python"lst2 = str2.split(",")print(lst2,type(lst2))# ['Hello', 'World', 'Python'] <class 'list'># 列表转字符串lst =['Hello','World','Python']str3 =",".join(lst)print(str3,type(str3))# "Hello,World,Python" <class 'str'>

十、类型转换的注意事项

1. 转换失败的情况

在进行类型转换时,如果目标类型不支持源类型的值,会引发TypeError或ValueError异常。

# 字符串转整数失败(字符串包含非数字字符)try:int("123abc")except ValueError as e:print(f"错误:{e}")# 错误:invalid literal for int() with base 10: '123abc'# 将字典转换为整数(类型不支持)try:int({"name":"Python"})except TypeError as e:print(f"错误:{e}")# 错误:int() argument must be a string, a bytes-like object or a real number, not 'dict'

2. 浮点数转整数的截断

使用int()函数将浮点数转换为整数时,会截断小数部分,而不是四舍五入。

print(int(3.999))# 3print(int(-3.999))# -3# 如果需要四舍五入,可以使用round()函数print(round(3.999))# 4print(round(-3.999))# -4

3. 集合转换的无序性

将列表或元组转换为集合时,集合的元素是无序的,且会自动去重。

lst =[3,1,4,1,5,9,2,6,5]=set(lst)print(s)# {1, 2, 3, 4, 5, 6, 9}(顺序可能不同)

4. 字典转换的键要求

将对象转换为字典时,键必须是不可变类型(如字符串、数字、元组)。

# 尝试使用列表作为键(会失败)try:    d ={[1,2]:"value"}except TypeError as e:print(f"错误:{e}")# 错误:unhashable type: 'list'# 使用元组作为键(可以)={(1,2):"value"}print(d)# {(1, 2): 'value'}

5. 字符串编码问题

在将字符串转换为字节序列时,必须指定正确的编码,否则可能会引发UnicodeEncodeError异常。

# 包含中文字符的字符串转换try:bytes("你好","ascii")except UnicodeEncodeError as e:print(f"错误:{e}")# 错误:'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)# 使用utf-8编码=bytes("你好","utf-8")print(b)# b'\xe4\xbd\xa0\xe5\xa5\xbd'

十一、总结

Python提供了丰富的数据类型转换函数,使程序员可以方便地在不同数据类型之间进行转换:

  1. 隐式转换
    :由Python解释器自动进行,无需程序员干预
  2. 显式转换
    :使用内置转换函数手动进行,包括:
    • 数字转换:int()float()complex()
    • 字符串转换:str()repr()
    • 布尔值转换:bool()
    • 序列转换:list()tuple()set()
    • 映射转换:dict()
    • 其他转换:bytes()bytearray()memoryview()

在进行类型转换时,需要注意以下几点:

  • 转换可能会失败,需要处理异常
  • 浮点数转整数会截断小数部分
  • 集合转换会自动去重且无序
  • 字典的键必须是不可变类型
  • 字符串转换为字节序列时需要指定正确的编码

掌握Python的数据类型转换对于编写高效、灵活的代码至关重要。

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-02-08 09:22:41 HTTP/2.0 GET : https://f.mffb.com.cn/a/465527.html
  2. 运行时间 : 0.112837s [ 吞吐率:8.86req/s ] 内存消耗:4,898.52kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=7fce3843991c5d604b071a683018e65c
  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.000733s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000875s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000544s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.006225s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000816s ]
  6. SELECT * FROM `set` [ RunTime:0.000218s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000647s ]
  8. SELECT * FROM `article` WHERE `id` = 465527 LIMIT 1 [ RunTime:0.000562s ]
  9. UPDATE `article` SET `lasttime` = 1770513761 WHERE `id` = 465527 [ RunTime:0.001263s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.005983s ]
  11. SELECT * FROM `article` WHERE `id` < 465527 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000696s ]
  12. SELECT * FROM `article` WHERE `id` > 465527 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.002015s ]
  13. SELECT * FROM `article` WHERE `id` < 465527 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.007326s ]
  14. SELECT * FROM `article` WHERE `id` < 465527 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.007047s ]
  15. SELECT * FROM `article` WHERE `id` < 465527 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.009031s ]
0.114465s