当前位置:首页>Linux>OS31.【Linux】文件IO (2) 文件描述符

OS31.【Linux】文件IO (2) 文件描述符

  • 2026-08-19 16:26:22
OS31.【Linux】文件IO (2) 文件描述符

目录

1.知识回顾

2.文件描述符

访问文件的本质

fd的数值分配规则

规则1、规则2

★规则3

FILE结构体

验证stdin、stdout、stderr对应的文件描述符

方法1:使用_fileno

方法2: 使用fileno()

方法3:查看/dev目录下的文件

引用计数

3.拓展阅读

4.补充练习题

5.补充: Linux的终端文件


1.知识回顾

参见OS29.【Linux】文件IO (1) open、write和close系统调用[1]文章

2.文件描述符

提出问题:FILE*和文件描述符fd有什么关系?

操作系统管理大量文件需要先描述再组织,而描述文件的各个属性需要结构体struct file,通常直接或间接包含以下信息:

1.在磁盘中的位置2.基本属性(权限、大小、读写位置、谁打开的、......)3.文件的内核缓冲区信息4.struct file* next 指针

struct file* next指针用于串联打开的文件(链表结构),便于操作系统增删查改文件,其结构体的定义在在linux内核v6.16.4的include/linux/fs.h中:

/** * struct file - Represents a file * @f_lock: Protects f_ep, f_flags. Must not be taken from IRQ context. * @f_mode: FMODE_* flags often used in hotpaths * @f_op: file operations * @f_mapping: Contents of a cacheable, mappable object. * @private_data: filesystem or driver specific data * @f_inode: cached inode * @f_flags: file flags * @f_iocb_flags: iocb flags * @f_cred: stashed credentials of creator/opener * @f_owner: file owner * @f_path: path of the file * @f_pos_lock: lock protecting file position * @f_pipe: specific to pipes * @f_pos: file position * @f_security: LSM security context of this file * @f_wb_err: writeback error * @f_sb_err: per sb writeback errors * @f_ep: link of all epoll hooks for this file * @f_task_work: task work entry point * @f_llist: work queue entrypoint * @f_ra: file's readahead state * @f_freeptr: Pointer used by SLAB_TYPESAFE_BY_RCU file cache (don't touch.) * @f_ref: reference count */struct file {spinlock_t      f_lock;fmode_t        f_mode;const struct file_operations  *f_op;struct address_space    *f_mapping;void        *private_data;struct inode      *f_inode;unsigned int      f_flags;unsigned int      f_iocb_flags;const struct cred    *f_cred;struct fown_struct    *f_owner;/* --- cacheline 1 boundary (64 bytes) --- */struct path      f_path;union {/* regular files (with FMODE_ATOMIC_POS) and directories */struct mutex    f_pos_lock;/* pipes */    u64      f_pipe;  };loff_t        f_pos;#ifdef CONFIG_SECURITYvoid        *f_security;#endif/* --- cacheline 2 boundary (128 bytes) --- */errseq_t      f_wb_err;errseq_t      f_sb_err;#ifdef CONFIG_EPOLLstruct hlist_head    *f_ep;#endifunion {struct callback_head  f_task_work;struct llist_node  f_llist;struct file_ra_state  f_ra;freeptr_t    f_freeptr;  };file_ref_t      f_ref;/* --- cacheline 3 boundary (192 bytes) --- */} __randomize_layout  __attribute__((aligned(4)));  /* lest something weird decides that 2 is OK */

访问文件的本质

在OS29.【Linux】文件IO (1) open、write和close系统调用文章提到过:

文件打开需要借助进程,可以推出:Linux的task_struct必定含有与文件相关的指针(task_struct的完整代码参见OS17.【Linux】进程基础知识(1)[2]文章),这里摘取一部分:

struct task_struct{//......struct files_struct  *files;//......{

在linux内核v6.16.4的include/linux/fdtable.h中,有定义"打开的文件的表结构"

/* * Open file table structure */struct files_struct {/*   * read mostly part   */atomic_t count;bool resize_in_progress;wait_queue_head_t resize_wait;struct fdtable __rcu *fdt;struct fdtable fdtab;/*   * written part on a separate cache line in SMP   */spinlock_t file_lock ____cacheline_aligned_in_smp;unsigned int next_fd;unsigned long close_on_exec_init[1];unsigned long open_fds_init[1];unsigned long full_fds_bits_init[1];struct file __rcu * fd_array[NR_OPEN_DEFAULT];};

这里只研究struct file __rcu * fd_array[NR_OPEN_DEFAULT],__rcu是修饰符,这里不讨论,NR_OPEN_DEFAULT宏是fd_array的初始化fd_array元素的个数

现简化处理files_struct,认为只含有fd_array:

fd_array顾名思义,是存放struct file*的的数组,有下图:

struct file(注在include/linux/fs.h中定义了struct file)对象之间会用链式结构串联起来.方便增删查改

进程每打开一个文件时,open内部会将这个文件的struct file的指针添加到fd_array中,并返回fd_array下标

int open(const char *pathname, int flags, ... /* mode_t mode */ );

fd的数值分配规则

例如以下代码:

#include <stdio.h>#include <unistd.h>#include <fcntl.h>#include <sys/stat.h>int main(){umask(0);int fd1=open("test1.txt",O_WRONLY|O_CREAT|O_APPEND,0666);if (fd1<0)    {perror("open failed");return -1;    }int fd2=open("test2.txt",O_WRONLY|O_CREAT|O_APPEND,0666);if (fd2<0)    {perror("open failed");return -1;    }int fd3=open("test3.txt",O_WRONLY|O_CREAT|O_APPEND,0666);if (fd3<0)    {perror("open failed");return -1;    }printf("test1.txt fd=%d\n",fd1);printf("test2.txt fd=%d\n",fd2);printf("test3.txt fd=%d\n",fd3);close(fd1);close(fd2);close(fd3);return 0;}

运行结果:

规则1、规则2

规则1.打开的文件默认从3开始编号

规则2.fd=0、1、2默认被占用,因为进程默认打开3个IO流,不是C语言的特性

stdin: 键盘文件

stdout: 显示器文件

stderr: 显示器文件

可以用和read和write函数尝试向这些流写入:

#include <stdio.h>#include <unistd.h>#include <fcntl.h>#include <sys/stat.h>#include <string.h>#define BUFFER_SIZE 20#define STDIN_STR 20int main(){//默认打开3个流,不需要手动openchar buffer[BUFFER_SIZE];char* msg1="stdout\n";char* msg2="stderr\n";char stdin_str[STDIN_STR];ssize_t len=read(0,stdin_str,BUFFER_SIZE);    stdin_str[len]='\0';write(1,stdin_str,strlen(stdin_str));write(1,msg1,strlen(msg1));write(2,msg2,strlen(msg2));return 0;}

运行结果:

解释:使用read系统调用将显示器文件中的字符串写入到stdin_str中(一开始会阻塞,因为在等待用户输入),read返回值如果大于0,那么表示实际读取的字符数,要想能打印字符串,必须先为stdin_str的结尾添加\0.然后将stdin_str的字符串写入到stdin中打印

write(1,msg1,strlen(msg1))和write(2,msg2,strlen(msg2))都像显示器写入字符串

注意:虽然C语言的三个流是FILE类型的,但在操作系统层面上只认识fd

说明fd=0是stdout,而fd=1是stderr在之后的文章会证明

★规则3

先关闭0号文件描述符指向的struct file,再新建一个文件

#include <stdio.h>#include <unistd.h>#include <fcntl.h>#include <sys/stat.h>int main(){close(0);umask(0);int fd=open("test.txt",O_WRONLY|O_CREAT|O_APPEND,0666);if (fd<0)    {perror("open failed");return -1;    }printf("test.txt fd=%d\n",fd);close(fd);return 0;}

运行结果:

先关闭2号文件描述符指向的struct file,再新建一个文件

#include <stdio.h>#include <unistd.h>#include <fcntl.h>#include <sys/stat.h>int main(){close(2);umask(0);int fd=open("test.txt",O_WRONLY|O_CREAT|O_APPEND,0666);if (fd<0)    {perror("open failed");return -1;    }printf("test.txt fd=%d\n",fd);close(fd);return 0;}

运行结果:

从这两段代码可以看出: close(0),打印的是0; close(2),打印的是2…..

得出规则3: 设置文件的描述符时,从0下标开始,寻找最小的没有用的数组位置,它的下标就是新文件的文件描述符

FILE结构体

上面提到了"虽然C语言的三个流是FILE类型的,但在操作系统层面上只认识fd",为了让FILE结构体与操作系统交互,FILE结构体内部必然含有fd

注意:FILE结构体和内核的file结构体没有任何关系

查看gilbc-2.42的源代码:

在libio/bits/types/FILE.h中:

#ifndef __FILE_defined#define __FILE_defined 1struct _IO_FILE;/* The opaque type of streams.  This is the definition used elsewhere.  */typedef struct _IO_FILE FILE;#endif

FILE实际上是struct _IO_FILE的别名

在libio/bits/types/struct_FILE.h中:

/* The tag name of this struct is _IO_FILE to preserve historic   C++ mangled names for functions taking FILE* arguments.   That name should not be used in new code.  */struct _IO_FILE{int _flags;    /* High-order word is _IO_MAGIC; rest is flags. *//* The following pointers correspond to the C++ streambuf protocol. */char *_IO_read_ptr;  /* Current read pointer */char *_IO_read_end;  /* End of get area. */char *_IO_read_base;  /* Start of putback+get area. */char *_IO_write_base;  /* Start of put area. */char *_IO_write_ptr;  /* Current put pointer. */char *_IO_write_end;  /* End of put area. */char *_IO_buf_base;  /* Start of reserve area. */char *_IO_buf_end;  /* End of reserve area. *//* The following fields are used to support backing up and undo. */char *_IO_save_base; /* Pointer to start of non-current get area. */char *_IO_backup_base;  /* Pointer to first valid character of backup area */char *_IO_save_end; /* Pointer to end of non-current get area. */struct _IO_marker *_markers;struct _IO_FILE *_chain;int _fileno;int _flags2:24;/* Fallback buffer to use when malloc fails to allocate one.  */char _short_backupbuf[1];__off_t _old_offset; /* This used to be _offset but it's too small.  *//* 1+column number of pbase(); 0 is unknown. */unsigned short _cur_column;signed char _vtable_offset;char _shortbuf[1];  _IO_lock_t *_lock;#ifdef _IO_USE_OLD_IO_FILE};

里面有一个int  _fileno,这是文件描述符

因为stdin、stdout和stderr本身是结构体指针类型,所以可以使用->来打印_fileno对应的值:

验证stdin、stdout、stderr对应的文件描述符
方法1:使用_fileno
#include <stdio.h>int main(){printf("stdin fd=%d\n",stdin->_fileno);printf("stdout fd=%d\n",stdout->_fileno);printf("stderr fd=%d\n",stderr->_fileno);return 0;}

运行结果:

方法2: 使用fileno()

当然,也可以使用stdio.h中的fileno()内部的宏来获取fd值:

声明:

int fileno(FILE *stream);

例如:

#include <stdio.h>int main(){printf("stdin fd=%d\n",fileno(stdin));return 0;}

运行结果:

细心的读者可能回去看glibc库中的实现,在glibc-2.42的/libio/fileno.c提供了__fileno的实现:

#include "libioP.h"#include <stdio.h>int__fileno (FILE *fp){CHECK_FILE (fp, EOF);if (!(fp->_flags & _IO_IS_FILEBUF) || _IO_fileno (fp) < 0)    {      __set_errno (EBADF);return -1;    }return _IO_fileno (fp);}libc_hidden_def (__fileno)weak_alias (__fileno, fileno)libc_hidden_weak (fileno)/* The fileno implementation for libio does not require locking because   it only accesses once a single variable and this is already atomic   (at least at thread level).  Therefore we don't test _IO_MTSAFE_IO here.  */weak_alias (__fileno, fileno_unlocked)

如果没问题的话,会执行宏_IO_fileno (fp)

这个宏在/libio/iolibio.h中:

#define _IO_fileno(FP) ((FP)->_fileno)extern FILE* _IO_popen (const char*, const char*) __THROW;
方法3:查看/dev目录下的文件
ls -l /dev

运行结果:

引用计数

一个文件可以被多个进程打开,那么该文件的struct file中专门有一个变量来记录有多少个进程打开了这个文件,这是引用计数

1. 如果有N个文件描述符指向该文件, 那么struct file的引用计数变量的大小等于N

2.如果某个文件的引用计数变量值为0,那么内核才会真正执行关闭文件的操作,回收struct file对象,文将件指针置为NULL

3.拓展阅读

linux应用层的write()函数如何调用到驱动中的write()函数?作者: 简叔[3]

4.补充练习题

Linux下两个进程可以同时打开同一个文件,这时如下描述错误的是:

1.一个进程对文件长度和内容的修改另外一个进程可以立即感知 ( )

2.任何一个进程删除该文件时,另外一个进程会立即出现读写失败 ( )

答案:

1.正确

因为文件内容的修改是直接反馈至磁盘文件系统中的,因此当文件内容被修改,其他进程因为也是针对磁盘数据的操作,因此可以立即感知到

可以做个测试:

#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>int main(){int fd=open("./file.txt",O_CREAT|O_WRONLY,0664);if (fd<0)    {perror("open failed");return 1;    }char buffer[]="teststring";for (;;)    {if (write(fd,buffer,sizeof(buffer)-1)==-1)        {perror("open failed");return 2;        }printf("写入了字符串\n");fflush(stdout);sleep(1);    }close(fd);return 0;}

开两个终端,一个执行以上代码,另外一个查看file.txt大小

运行结果:打印出来文件大小一直在变

2.正确

删除文件实际上一开始是删除文件的目录项,文件的数据以及inode并不会立即被删除,因为进程打开

文件的struct file数据结构仍然存在因此若进程已经打开文件,文件被删除时,并不会影响进程的操作,因为进程已经具备文件的描述信息

仍然使用上面的代码,开两个终端,一个执行以上代码,另外一个执行rm file.txt

运行结果: 正常删除

5.补充: Linux的终端文件

打开xshell,打开多个窗口,这里打开4个终端,都以同一个用户的身份登录:

此时查看/dev/pts下的内容:

ls -l /dev/pts

注: pts全称是pseudo terminal slave,伪终端从设备; ptmx全称是pseudo terminal multiplexor. 可以看看pts(4) - Linux manual page[4]的描述

关掉其中一个终端,再查看/dev/pts中的文件:

关掉其中一个终端,再查看/dev/pts中的文件:

尝试向/dev/pts/1中显示数据:

结论1: /dev/pts其中一个名称为数字的文件就是一个终端文件

关掉其中一个终端,再查看/dev/pts中的文件:

结论2: 如果开了多个终端,会在/dev/pts目录下生成多个终端文件

除此之外,可以看看stackexchange的两个回答:linux - What is stored in /dev/pts files and can we open them? - Unix & Linux Stack Exchange[5]

tty - How does a Linux terminal work? - Unix & Linux Stack Exchange[6]

参考资料

[1] 

OS29.【Linux】文件IO (1) open、write和close系统调用: https://zhangcoder.blog.csdn.net/article/details/151083204?spm=1011.2415.3001.5331

[2] 

OS17.【Linux】进程基础知识(1): https://zhangcoder.blog.csdn.net/article/details/149281546?spm=1011.2415.3001.5331

[3] 

linux应用层的write()函数如何调用到驱动中的write()函数?作者: 简叔: https://mp.weixin.qq.com/s/XmWJMbPGZANyVKRJn1WNYw

[4] 

pts(4) - Linux manual page: https://www.man7.org/linux/man-pages/man4/pts.4.html

[5] 

linux - What is stored in /dev/pts files and can we open them? - Unix & Linux Stack Exchange: https://unix.stackexchange.com/questions/93531/what-is-stored-in-dev-pts-files-and-can-we-open-them

[6] 

tty - How does a Linux terminal work? - Unix & Linux Stack Exchange: https://unix.stackexchange.com/questions/79334/how-does-a-linux-terminal-work

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-08-21 13:35:17 HTTP/2.0 GET : https://f.mffb.com.cn/a/510815.html
  2. 运行时间 : 0.359247s [ 吞吐率:2.78req/s ] 内存消耗:4,648.88kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=82ab2bcb962bc9af32dbb52047bacb7a
  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.001001s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001489s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.035127s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000648s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001184s ]
  6. SELECT * FROM `set` [ RunTime:0.000569s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001392s ]
  8. SELECT * FROM `article` WHERE `id` = 510815 LIMIT 1 [ RunTime:0.004306s ]
  9. UPDATE `article` SET `lasttime` = 1787290517 WHERE `id` = 510815 [ RunTime:0.034308s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 67 LIMIT 1 [ RunTime:0.000824s ]
  11. SELECT * FROM `article` WHERE `id` < 510815 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.015682s ]
  12. SELECT * FROM `article` WHERE `id` > 510815 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.001227s ]
  13. SELECT * FROM `article` WHERE `id` < 510815 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.016986s ]
  14. SELECT * FROM `article` WHERE `id` < 510815 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.077654s ]
  15. SELECT * FROM `article` WHERE `id` < 510815 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.014676s ]
0.362875s