当前位置:首页>python>ctypes进阶:Python与硬件/系统API交互的指针与句柄全解析

ctypes进阶:Python与硬件/系统API交互的指针与句柄全解析

  • 2026-06-28 21:21:09
ctypes进阶:Python与硬件/系统API交互的指针与句柄全解析

ctypes是Python的一个外部函数库,它提供了与C兼容的数据类型,并允许调用动态链接库/共享库中的函数。这使得Python能够直接与硬件设备或操作系统API进行交互,特别适合需要高性能或底层访问的场景。

一、ctypes基础概念

1.1 ctypes简介

ctypes是Python标准库的一部分,它允许:

  • • 调用C语言编写的动态链接库(DLL)或共享库(.so)中的函数
  • • 定义与C兼容的数据类型
  • • 处理指针和结构体
  • • 管理内存分配和释放

1.2 基本数据类型映射

ctypes定义了与C语言基本数据类型对应的Python类:

C类型
ctypes类型
Python类型
大小(字节)
char
c_char
单字符
1
wchar_t
c_wchar
Unicode字符
2/4
short
c_short
int
2
int
c_int
int
4
long
c_long
int
4/8
long long
c_longlong
int
8
unsigned char
c_ubyte
int
1
unsigned short
c_ushort
int
2
unsigned int
c_uint
int
4
unsigned long
c_ulong
int
4/8
float
c_float
float
4
double
c_double
float
8
void*
c_void_p
int/long
4/8

二、处理指针

指针是C语言中非常重要的概念,ctypes提供了多种方式来处理指针。

2.1 基本指针操作

from ctypes import *# 创建一个整数num = c_int(42)# 创建指向该整数的指针ptr = pointer(num)# 通过指针访问值print(ptr.contents.value)  # 输出: 42# 修改指针指向的值ptr.contents.value = 100print(num.value)  # 输出: 100

2.2 指针数组

from ctypes import *# 创建整数数组arr = (c_int * 5)(12345)# 创建指向数组的指针arr_ptr = cast(arr, POINTER(c_int))# 遍历数组for i inrange(5):print(arr_ptr[i])  # 输出: 1 2 3 4 5

2.3 多级指针

from ctypes import *# 创建整数num = c_int(100)# 创建一级指针ptr1 = pointer(num)# 创建二级指针ptr2 = pointer(ptr1)# 访问值print(ptr2.contents.contents.value)  # 输出: 100

2.4 函数指针

from ctypes import *# 定义一个简单的C函数类型CALLBACK = CFUNCTYPE(c_int, c_int, c_int)# 定义Python函数作为回调defpy_add(a, b):return a + b# 创建函数指针add_func = CALLBACK(py_add)# 模拟C函数调用result = add_func(34)print(result)  # 输出: 7

三、处理句柄(Handle)

句柄是Windows编程中常见的概念,代表对内核对象的引用。ctypes可以很好地处理各种句柄类型。

3.1 基本句柄操作

from ctypes import *from ctypes.wintypes import HANDLE# 通常句柄是整数或指针类型# 创建一个无效句柄示例h_invalid = HANDLE(0)# 在实际API调用中,句柄通常由API函数返回# 例如: CreateFile返回文件句柄kernel32 = windll.kernel32# 打开一个文件获取句柄h_file = kernel32.CreateFileW("test.txt",                # 文件名0xC0000000,               # GENERIC_READ | GENERIC_WRITE0,                         # 共享模式None,                      # 安全属性3,                         # CREATE_ALWAYS0x80,                      # FILE_ATTRIBUTE_NORMALNone# 模板文件句柄)if h_file != HANDLE(-1).value:  # 检查是否成功print(f"文件句柄: {h_file}")# 使用完毕后关闭句柄    kernel32.CloseHandle(h_file)else:print("打开文件失败")

3.2 结构体中的句柄

from ctypes import *from ctypes.wintypes import *# 定义Windows SECURITY_ATTRIBUTES结构体classSECURITY_ATTRIBUTES(Structure):    _fields_ = [        ("nLength", DWORD),        ("lpSecurityDescriptor", LPVOID),        ("bInheritHandle", BOOL)    ]# 创建结构体实例sa = SECURITY_ATTRIBUTES()sa.nLength = sizeof(SECURITY_ATTRIBUTES)sa.bInheritHandle = TRUE# 使用结构体调用APIkernel32 = windll.kernel32h_event = kernel32.CreateEventW(    byref(sa),      # 安全属性    TRUE,           # 手动重置    FALSE,          # 初始非触发状态None# 事件名称)if h_event:print(f"事件句柄: {h_event}")    kernel32.CloseHandle(h_event)else:print("创建事件失败")

四、完整案例:与Windows API交互

案例1:枚举窗口

from ctypes import *from ctypes.wintypes import *# 定义Windows API函数和常量user32 = windll.user32# 常量定义GW_HWNDFIRST = 0GW_HWNDNEXT = 1# 定义回调函数类型EnumWindowsProc = WINFUNCTYPE(BOOL, HWND, LPARAM)# 全局变量用于存储窗口标题window_titles = []# 回调函数实现defenum_windows_proc(hwnd, lparam):    length = user32.GetWindowTextLengthW(hwnd)if length > 0:        buffer = create_unicode_buffer(length + 1)        user32.GetWindowTextW(hwnd, buffer, length + 1)        window_titles.append(buffer.value)returnTrue# 枚举所有顶层窗口user32.EnumWindows(EnumWindowsProc(enum_windows_proc), 0)# 打印结果print("找到的窗口:")for title in window_titles:print(title)

案例2:读取内存(需管理员权限)

from ctypes import *from ctypes.wintypes import *# 定义Windows API函数kernel32 = windll.kernel32# 打开进程defopen_process(pid, desired_access):    h_process = kernel32.OpenProcess(desired_access, FALSE, pid)ifnot h_process:raise WinError()return h_process# 读取内存defread_memory(h_process, address, size):    buffer = create_string_buffer(size)    bytes_read = c_size_t()ifnot kernel32.ReadProcessMemory(        h_process,         address,         buffer,         size,         byref(bytes_read)    ):raise WinError()return buffer.raw# 示例:读取当前进程的某个内存位置(仅示例,实际地址需要确定)try:# 获取当前进程ID    current_pid = kernel32.GetCurrentProcessId()# 打开进程(需要PROCESS_VM_READ权限)    h_process = open_process(current_pid, 0x0010)  # PROCESS_VM_READ# 假设我们要读取0x1000处的4字节(实际地址需要确定)    address = 0x1000    size = 4    data = read_memory(h_process, address, size)print(f"从地址 {hex(address)} 读取的数据: {data}")    kernel32.CloseHandle(h_process)except Exception as e:print(f"错误: {e}")

案例3:与硬件交互(通过设备驱动)

from ctypes import *from ctypes.wintypes import *# 定义设备控制码(示例值,实际需要根据设备驱动文档)IOCTL_EXAMPLE_DEVICE_CONTROL = 0x80000000 | (FILE_DEVICE_UNKNOWN << 16) | (FILE_ANY_ACCESS << 14) | (0x800 << 2) | 0# 定义输入输出结构体classDeviceIoControlInput(Structure):    _fields_ = [        ("Command", DWORD),        ("Value", DWORD),        ("Reserved", DWORD * 8)    ]classDeviceIoControlOutput(Structure):    _fields_ = [        ("Status", DWORD),        ("Result", DWORD),        ("Data", BYTE * 256)    ]# 打开设备defopen_device(device_path):    h_device = kernel32.CreateFileW(        device_path,        GENERIC_READ | GENERIC_WRITE,0,  # 共享模式None,  # 安全属性        OPEN_EXISTING,0,  # 文件属性None    )if h_device == INVALID_HANDLE_VALUE:raise WinError()return h_device# 设备控制defdevice_io_control(h_device, control_code, input_data, output_buffer_size):    output_buffer = create_string_buffer(output_buffer_size)    bytes_returned = DWORD()ifnot kernel32.DeviceIoControl(        h_device,        control_code,        byref(input_data),        sizeof(input_data),        byref(output_buffer),        output_buffer_size,        byref(bytes_returned),None    ):raise WinError()return output_buffer, bytes_returned.value# 示例使用try:# 打开设备(需要知道实际设备路径)    h_device = open_device("\\\\.\\ExampleDevice")# 准备输入数据    input_data = DeviceIoControlInput()    input_data.Command = 1    input_data.Value = 0x1234# 执行设备控制    output_buffer, bytes_returned = device_io_control(        h_device,        IOCTL_EXAMPLE_DEVICE_CONTROL,        input_data,        sizeof(DeviceIoControlOutput)    )# 解析输出    output = DeviceIoControlOutput.from_buffer_copy(output_buffer)print(f"Status: {output.Status}, Result: {output.Result}")    kernel32.CloseHandle(h_device)except Exception as e:print(f"错误: {e}")

五、最佳实践与注意事项

5.1 错误处理

from ctypes import *from ctypes.wintypes import *kernel32 = windll.kernel32try:# 尝试打开一个不存在的文件    h_file = kernel32.CreateFileW("nonexistent.txt",0xC0000000,0,None,3,0x80,None    )if h_file == INVALID_HANDLE_VALUE:# 获取并打印错误代码        err_code = kernel32.GetLastError()print(f"错误代码: {err_code}")# 使用ctypes.WinError获取错误描述import ctypes.wintypes as wintypesraise WinError(err_code)# 如果成功,继续操作...    kernel32.CloseHandle(h_file)except Exception as e:print(f"操作失败: {e}")

5.2 内存管理

from ctypes import *# 分配内存buffer_size = 1024buffer = (c_ubyte * buffer_size)()# 使用内存...for i inrange(buffer_size):    buffer[i] = i % 256# 不需要显式释放,Python的垃圾回收会处理# 但对于更复杂的场景,可能需要使用:# - create_string_buffer# - cast# - byref# 等函数来管理内存

5.3 数据类型转换

from ctypes import *# C字符串到Python字符串c_str = create_string_buffer(b"Hello")py_str = c_str.value.decode('ascii')print(py_str)  # 输出: Hello# Python字符串到C字符串py_str = "World"c_str = create_string_buffer(py_str.encode('ascii'))print(c_str.value)  # 输出: b'World'# Unicode字符串处理c_wstr = create_unicode_buffer("Unicode测试")py_wstr = c_wstr.valueprint(py_wstr)  # 输出: Unicode测试

5.4 跨平台考虑

import sysfrom ctypes import *if sys.platform == "win32":# Windows特定代码    kernel32 = windll.kernel32    HANDLE = c_void_pelif sys.platform == "linux":# Linux特定代码    libc = CDLL("libc.so.6")# Linux通常使用整数作为文件描述符# 可能需要定义不同的类型else:raise NotImplementedError("不支持的平台")

ctypes为Python提供了强大的能力来与硬件和操作系统API交互,特别是通过指针和句柄的处理。关键点包括:

  1. 1. 指针处理:理解如何创建、传递和操作指针,包括指针数组和多级指针
  2. 2. 句柄管理:正确处理各种Windows句柄类型,包括在结构体中的使用
  3. 3. 错误处理:使用GetLastError和WinError来获取详细的错误信息
  4. 4. 内存管理:注意内存分配和释放,避免内存泄漏
  5. 5. 数据类型转换:在C和Python数据类型之间进行正确转换
  6. 6. 跨平台:考虑不同平台的差异,编写可移植代码

通过合理使用ctypes,Python可以突破其通常的高层抽象限制,直接与底层硬件和操作系统交互,实现高性能或特殊功能的程序。然而,这也要求开发者对C语言和目标平台API有较好的理解,以及谨慎处理内存和资源管理问题。

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-04 11:05:39 HTTP/2.0 GET : https://f.mffb.com.cn/a/487759.html
  2. 运行时间 : 0.108109s [ 吞吐率:9.25req/s ] 内存消耗:4,561.09kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=d2a04effb39b53a1d8163ab7b76aefe3
  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.000623s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000765s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000369s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000301s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000587s ]
  6. SELECT * FROM `set` [ RunTime:0.000261s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000571s ]
  8. SELECT * FROM `article` WHERE `id` = 487759 LIMIT 1 [ RunTime:0.000590s ]
  9. UPDATE `article` SET `lasttime` = 1783134339 WHERE `id` = 487759 [ RunTime:0.019272s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.002112s ]
  11. SELECT * FROM `article` WHERE `id` < 487759 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.002807s ]
  12. SELECT * FROM `article` WHERE `id` > 487759 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000495s ]
  13. SELECT * FROM `article` WHERE `id` < 487759 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.000822s ]
  14. SELECT * FROM `article` WHERE `id` < 487759 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.001925s ]
  15. SELECT * FROM `article` WHERE `id` < 487759 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.001082s ]
0.109788s