当前位置:首页>Linux>Linux环境下C语言实现ping命令

Linux环境下C语言实现ping命令

  • 2026-08-18 23:11:41
Linux环境下C语言实现ping命令

Linux环境下C语言实现ping命令

涉及的知识点

ICMP的报文格式 可以看到ICMP位于网络层,是网络层协议。ICMP作为IP层数据报的数据,加上数据报的首部,组成IP数据报发送出去。 ICMP报文包含在IP数据报中,IP报头在ICMP报文的最前面。一个ICMP报文包括IP报头(至少20字节)、ICMP报头(至少八字节)和ICMP报文(属于ICMP报文的数据部分)。当IP报头中的协议字段值为1时,就说明这是一个ICMP报文。 类型:占1字节,标识ICMP报文的类型,从类型值来看ICMP报文可以分为两大类。第一类是取值为1~127的差错报文,第2类是取值128以上的信息报文 代码:占1字节,标识对应ICMP报文的代码。它与类型字段一起共同标识了ICMP报文的详细类型 校验和:占2字节,这是对包括ICMP报文数据部分在内的整个ICMP数据报的校验和,以检验报文在传输过程中是否出现了差错 内容:占8字节。 IP数据包格式 首部至少需要20个字节(4X5)最后得到ip头+ICMP头=28字节 setsockopt函数的使用

开启IP_HDRINCL特性,我们完全自己手动构造IP报文int on = 1;`:定义了一个整型变量 `on`,并将其初始化为 1。这个变量将用于设置套接字选项,以控制是否包含 IP 头部。setsockopt(sockfd, IPPROTO_IP, IP_HDRINCL, &onsizeof(on));`:调用了 `setsockopt` 函数,将套接字选项 `IP_HDRINCL` 设置为 `on`。这个选项的作用是控制发送的数据包中是否包含 IP 头部。当 `on` 的值为 1 时,表示发送的数据包中包含 IP 头部;当 `on` 的值为其他非零值时,表示发送的数据包中不包含 IP 头部,系统将根据目的地址自动生成 IP 头部。

Linux信号量的使用 SIGALRM信号是操作系统中的其中一个信号。他的作用是设置进程隔多久后会收到一个SIGALRM信号

#include<unistd.h>#include<stdio.h>#include<stdlib.h>#include<signal.h>voidhandle_alarm()    exit(0); intmain(int argc, char *argv[])    signal(SIGALRM, handle_alarm);     alarm(10);     while(1) {} 

进程在10秒或10秒之后触发SIGALRM信号,然后执行信号处理函数,最后退出。

setitimer函数的使用 setitimer函数用于设置定时器,并指定定时器到期后所产生的信号行为。其函数原型如下:

#include<sys/time.h>//int setitimer(int which, const struct itimerval *new_value, struct itimerval *old_value);/*该函数接受三个参数:which:指定定时器类型,可以是以下两个值之一:ITIMER_REAL:真实时间定时器,使用系统实时时间,到期后将发送SIGALRM信号。ITIMER_VIRTUAL:虚拟时间定时器,使用进程运行时间,到期后将发送SIGVTALRM信号。ITIMER_PROF:以两者之和作为时间基准,到期后将发送SIGPROF信号。new_value:一个指向struct itimerval结构体的指针,用于指定新的定时器值(启动时间和间隔时间)。it_value字段表示定时器首次到期的时间间隔。it_interval字段表示定时器循环触发的时间间隔。old_value:一个指向struct itimerval结构体的指针,用于获取旧的定时器值,即之前设置的定时器值。如果不需要获取旧的定时器值,则可以传入NULL。调用setitimer函数后,会根据new_value所指定的定时器值来启动或修改定时器。到期后,系统会发送相应的信号,并根据信号处理机制执行相应的操作。可以使用signal函数或sigaction函数来捕获并处理定时器到期产生的信号。以下是一个示例代码,演示如何使用setitimer函数设置一个定时器:*/#include<stdio.h>#include<stdlib.h>#include<sys/time.h>#include<signal.h>voidtimer_handler(int signum){    printf("Timer expired!\n");}intmain(){    struct itimerval timer;    // 设置首次触发定时器为1秒后,定时器到期后每10秒触发一次    timer.it_interval.tv_sec = 10;    timer.it_interval.tv_usec = 0;    timer.it_value.tv_sec = 1;    timer.it_value.tv_usec = 0;    // 注册信号处理函数    signal(SIGALRM, timer_handler);    // 启动定时器    setitimer(ITIMER_REAL, &timer, NULL);    // 死循环,等待定时器到期    while (1);    return 0;}/*上述代码中,我们设置了一个定时器,其初次到期时间为1秒后,之后每10秒触发一次。当定时器到期时,会触发SIGALRM信号,并通过注册的信号处理函数timer_handler进行处理。在示例代码中,我们只是简单地打印一条信息并没有做其他处理。*/

gettimeofday:函数用于获取当前时间,包括秒数和微秒数。它的函数原型如下:

#include<sys/time.h>intgettimeofday(struct timeval *tv, struct timezone *tz);- `tv`参数是一个指向`timeval`结构体的指针,用于存储获取的时间信息。- `tz`参数是一个指向`timezone`结构体的指针,用于存储时区信息。在现代Linux系统中,通常可以将其设置为NULL,不使用时区信息`timeval`结构体定义如下:struct timeval {    time_t      tv_sec;     // 秒    suseconds_t tv_usec;    // 微秒};
#include<stdio.h>#include<sys/time.h>intmain(){    struct timeval tv;    /* 获取当前时间 */    if (gettimeofday(&tv, NULL) == 0) {        printf("Current time: %ld seconds, %ld microseconds\n", tv.tv_sec, tv.tv_usec);    } else {        perror("gettimeofday");        return 1;    }    return 0;}

在这个示例中,我们首先定义了一个timeval结构体变量tv,然后调用gettimeofday函数获取当前时间,并将结果打印出来。

checksum校验怎么算出来的 如上面,我们得到IP帧头部实际数据(十六进制):

45 00 00 91 10 1b 00 00 40 11 a9 98 c0 a8 00 01 ff ff ff ff

我们看到Wireshark分析出来的Header Checksum是0xa998,下面我们计算验证一下。 1.根据IPv4头部格式,我们知道第11和12个字节是要填写的Checksum,先把这两个字节都设置为0,得到

45 00 00 91 10 1b 00 00 40 11 00 00 c0 a8 00 01 ff ff ff ff

2.每两个字节组成一个数字,然后累加

4500 0091 101b 0000  4011  0000 c0a8  0001  ffff  ffff 4500 + 0091 + 101b + 0000 +  4011 + 0000  + c0a8 + 0001 +  ffff  + ffff = 0x35664

3.把后面两个字节组成的数字5664 和 进位3相加,上面的 3 5664,分开两个数相加就是

3 + 5664 = 5667,一般是写成 5664 + 3 = 0x5667

4.取反,C语言用~符号

~(0x5667) = 0xa998

思路已经很清晰了,下面就是编码实现

#include<stdio.h>typedef unsigned short u_int16_t;typedef unsigned char u_int8_t;u_int16_tchecksum(u_int16_t *packet, int packlen){    /* 定义sum大小为8字节,定义小了,会累计的时候会出现位数不够 ,丢失高位的数据 */unsigned long sum = 0;//求和while (packlen > 1) {		sum = sum  + *(packet++);		packlen = packlen - 2;}/* 因为两个字节合并unsigned short整型做计算,所以如果报文大小为奇数字节则单独加上最后一个字节的数据 */    if  (packlen > 0)        sum = sum + *(unsigned char *)packet;/* TODO: this depends on byte order 不理解这里写这个干嘛 *//* 如果存在溢出则截断高16位数据与低16位数据求和,如sum=0x386B6 则sum=0x86B6 + 0x3 */while (sum >> 16)		sum = (sum & 0xffff) + (sum >> 16);/* sum取反码,转为2个字节,不然会把高位的ffff这些都输出了 */return (u_int16_t)~sum;}intmain(int argc, char *argv[]){    int i = 0;    int j = 0;    unsigned short checksumvalue[20];    unsigned char bytes[] = {        0xa40xae0x110x170x490xe70xf40xde        0xaf0xed0xd00x150x080x000x450x00        0x000x910x100x1b0x000x000x400x11        0xa90x980xc00xa80x000x010xff0xff,        0xff0xff0x010xbb0xe30xa60x6a0xd5        0x1e0x6b0x560xc10x3f0xc30x800x12        0xfa0xf00x0c0xae0x000x000x020x04        0x050xac0x010x030x030x080x010x01        0x040x02    };    printf("合并后的值:\n");    /* 从0x45到0xff每两个字节合并为一个十六进制数 */    for (i = 14; i < 33; i += 2) {        checksumvalue[j] = (bytes[i] << 8) | bytes[i+1];        printf("0x%04x\n", checksumvalue[j]);        j++;    }    /* 把第11,12字节合并后的数据0xa998, 即数组里面的checksumvalue[5] 置为0 */    checksumvalue[5] = 0    u_int16_t ip_checksum = checksum(checksumvalue, 20);printf("ip checksum: 0x%04x\n", ip_checksum);    return 0;}

运行结果如下:

完整代码如下:

#define ICMP_ECHOREPLY 0 /* Echo应答*/#define ICMP_ECHO   /*Echo请求*/#define BUFSIZE 1500    /*发送缓存最大值*/#define DEFAULT_LEN 56  /**ping消息数据默认大小/  /*数据类型别名*/  typedef unsigned char u8;  typedef unsigned short u16;  typedef unsigned int u32;  /*ICMP消息头部*/  struct icmphdr {      u8 type;     /*定义消息类型*/      u8 code;    /*定义消息代码*/      u16 checksum;   /*定义校验*/      union{          struct{          u16 id;          u16 sequence;      }echo;      u32 gateway;      struct{          u16 unsed;          u16 mtu;      }frag; /*pmtu实现*/      }un;    /*ICMP数据占位符*/      u8 data[0];  #define icmp_id un.echo.id  #define icmp_seq un.echo.sequence  };  #define ICMP_HSIZE sizeof(struct icmphdr)  /*定义一个IP消息头部结构体*/  struct iphdr {      u8 hlen:4, ver:4;   /*定义4位首部长度,和IP版本号为IPV4*/      u8 tos;/*8位服务类型TOS*/      u16 tot_len;/*16位总长度*/      u16 id;/*16位标志位*/      u16 frag_off;/*3位标志位*/      u8 ttl;/*8位生存周期*/      u8 protocol;/*8位协议*/      u16 check;/*16位IP首部校验和*/      u32 saddr;/*32位源IP地址*/      u32 daddr;/*32位目的IP地址*/  };  char *hostname;/*被ping的主机名*/  int datalen = DEFAULT_LEN;  /*ICMP消息携带的数据长度*/  char sendbuf[BUFSIZE];      /*发送字符串数组*/   char recvbuf[BUFSIZE];      /*接收字符串数组*/  int nsent;/*发送的ICMP消息序号*/  int nrecv;/*接收的ICMP消息序号*/  pid_t pid;/*ping程序的进程PID*/  struct timeval recvtime;    /*收到ICMP应答的时间戳*/  int sockfd;/*发送和接收原始套接字*/  struct sockaddr_in dest;    /*被ping的主机IP*/  struct sockaddr_in from;    /*发送ping应答消息的主机IP*/  struct sigaction act_alarm;  struct sigaction act_int;  /*函数原型*/  voidalarm_handler(int);/*SIGALRM处理程序*/  voidint_handler(int);/*SIGINT处理程序*/  voidset_sighandler();/*设置信号处理程序*/  voidsend_ping();/*发送ping消息*/  voidrecv_reply();/*接收ping应答*/  u16 checksum(u8 *buf, int len)/*计算校验和*/  inthandle_pkt();/*ICMP应答消息处理*/  voidget_statistics(intint);  /*统计ping命令的检测结果*/  voidbail(constchar *);/*错误报告*/
#include<stdio.h>#include<stdlib.h>#include<sys/time.h>/*是Linux系统的日期时间头文件*/#include<unistd.h>/* 是POSIX标准定义的unix类系统定义符号常量的头文件,包含了许多UNIX系统服务的函数原型,例如read函数、write函数和getpid函数*/#include<string.h>#include<sys/socket.h>/*对与引用socket函数必须*/#include<sys/types.h>#include<netdb.h>/*定义了与网络有关的结构,变量类型,宏,函数。函数gethostbyname()用*/#include<errno.h>/*sys/types.h中文名称为基本系统数据类型*/#include<arpa/inet.h>/*inet_ntoa()和inet_addr()这两个函数,包含在 arpa/inet.h*/#include<signal.h>/*进程对信号进行处理*/#include<netinet/in.h>/*互联网地址族*/#include"test.h"#define IP_HSIZE sizeof(struct iphdr)   /*定义IP_HSIZE为ip头部长度*/#define IPVERSION  4   /*定义IPVERSION为4,指出用ipv4*//*设置的时间是一个结构体,倒计时设置,重复倒时,超时值设为1秒*/  struct itimerval val_alarm = {.it_interval.tv_sec = 1,      .it_interval.tv_usec = 0,  .it_value.tv_sec = 0,  .it_value.tv_usec = 1  };  /*argc表示隐形程序命令行中参数的数目,argv是一个指向字符串数组指针,其中每一个字符对应一个参数*/intmain(int argc,char **argv){  struct hostent*host; /*该结构体属于include<netdb.h>*/       int					on = 1;      if( argc < 2)/*判断是否输入了地址*/ {       printf("Usage: %s hostname\n",argv[0]);  exit(1);      }  /*gethostbyname()返回对应于给定主机名的包含主机名字和地址信息的结构指针,*/     //if((host = getaddrinfo(argv[1])) == NULL)    if((host = gethostbyname(argv[1])) == NULL){     printf("usage:%s hostname/IP address\n", argv[0]);exit(1);      }      hostname = argv[1];/*取出地址名*/  memset(&dest,0,sizeof dest);/*将dest中前sizeof(dest)个字节替换为0并返回s,此处为初始化,给最大内存清零*/  	dest.sin_family=PF_INET;/*PF_INET为IPV4,internet协议,在<netinet/in.h>中,地址族*/   	dest.sin_port=ntohs(0);/*端口号,ntohs()返回一个以主机字节顺序表达的数。*/  	dest.sin_addr=*(struct in_addr *)host->h_addr_list[0];/*host->h_addr_list[0]是地址的指针.返回IP地址,初始化*/  /*PF_INEI套接字协议族,SOCK_RAW套接字类型,IPPROTO_ICMP使用协议,	调用socket函数来创建一个能够进行网络通信的套接字。这里判断是否创建成功*/ if((sockfd = socket(PF_INET, SOCK_RAW, IPPROTO_ICMP)) < 0){  perror("RAW socket created error");  exit(1);      }  /*设置当前套接字选项特定属性值,sockfd套接字,IPPROTO_IP协议层为IP层,	IP_HDRINCL套接字选项条目,套接字接收缓冲区指针,sizeof(on)缓冲区长度的长度*/     setsockopt(sockfd, IPPROTO_IP, IP_HDRINCL, &on, sizeof(on));   /*getuid()函数返回一个调用程序的真实用户ID,setuid()是让普通用户	可以以root用户的角色运行只有root帐号才能运行的程序或命令。*/ //setuid(getuid()); //pid = getpid(); /*getpid函数用来取得目前进程的进程识别码*/  set_sighandler();/*对信号处理*/  printf("Ping %s(%s): %d bytes data in ICMP packets.\n", argv[1], inet_ntoa(dest.sin_addr), datalen);      //alarm(1);if((setitimer(ITIMER_REAL, &val_alarm, NULL)) == -1/*定时函数*/  {        bail("setitimer fails.");  }    recv_reply(); /*接收ping应答*/  return 0;  }  /*发送ping消息*/  voidsend_ping(void){      struct iphdr*ip_hdr;   /*iphdr为IP头部结构体*/      struct icmphdr*icmp_hdr;   /*icmphdr为ICMP头部结构体*/      int					len;      int					len1;  /*ip头部结构体变量初始化*/      ip_hdr=(struct iphdr *)sendbuf; /*字符串指针*/         ip_hdr->hlen=sizeof(struct iphdr)>>2;  /*头部长度*/      ip_hdr->ver=IPVERSION;   /*版本*/      ip_hdr->tos=0;   /*服务类型*/      ip_hdr->tot_len=IP_HSIZE+ICMP_HSIZE+datalen; /*报文头部加数据的总长度*/      ip_hdr->id=0;    /*初始化报文标识*/      ip_hdr->frag_off=0;  /*设置flag标记为0*/      ip_hdr->protocol=IPPROTO_ICMP;/*运用的协议为ICMP协议*/      ip_hdr->ttl=255/*一个封包在网络上可以存活的时间*/      ip_hdr->daddr=dest.sin_addr.s_addr;  /*目的地址*/      len1=ip_hdr->hlen<<2;  /*ip数据长度*/      /*ICMP头部结构体变量初始化*/      icmp_hdr=(struct icmphdr *)(sendbuf+len1);  /*字符串指针*/      icmp_hdr->type=8;    /*初始化ICMP消息类型type*/      icmp_hdr->code=0;    /*初始化消息代码code*/      icmp_hdr->icmp_id=pid;   /*把进程标识码初始给icmp_id*/      icmp_hdr->icmp_seq=nsent++;  /*发送的ICMP消息序号赋值给icmp序号*/          memset(icmp_hdr->data,0xff,datalen);  /*将datalen中前datalen个字节替换为0xff并返回icmp_hdr-dat*/        gettimeofday((struct timeval *)icmp_hdr->data,NULL); /* 获取当前时间*/      len=ip_hdr->tot_len; /*报文总长度赋值给len变量*/      icmp_hdr->checksum=0;    /*初始化*/      icmp_hdr->checksum=checksum((u8 *)icmp_hdr,len);  /*计算校验和*/      sendto(sockfd,sendbuf,len,0,(struct sockaddr *)&dest,sizeof (dest)); /*经socket传送数据*/  }  /*接收程序发出的ping命令的应答*/  voidrecv_reply(){  int			n;  int			len;      int			errno;      n = 0;	nrecv = 0;      len = sizeof(from);   /*发送ping应答消息的主机IP*/      while(nrecv < 6){  /*经socket接收数据,如果正确接收返回接收到的字节数,失败返回0.*/if((n=recvfrom(sockfd, recvbuf, sizeof(recvbuf), 0, (struct sockaddr *)&from, &len))<0){   if(errno==EINTR)  /*EINTR表示信号中断*/  continue;              bail("recvfrom error");          }  gettimeofday(&recvtime, NULL);   /*记录收到应答的时间*/  if(handle_pkt())    /*接收到错误的ICMP应答信息*/  continue;  		nrecv++;      }      //get_statistics(nsent, nrecv);     /*统计ping命令的检测结果*/  }   /*计算校验和*/  u16 checksum(u8 *buf,int len){      u32 sum	= 0;      u16 *cbuf;      cbuf = (u16 *)buf;      while(len > 1){  		sum += *cbuf++;  		len -= 2;      }      if(len){        sum += *(u8 *)cbuf;  }	sum = (sum >> 16) + (sum & 0xffff);  	sum += (sum >> 16);  return ~sum;  }  /*ICMP应答消息处理*/  inthandle_pkt(){  struct iphdr*ip;      struct icmphdr*icmp;      int					ip_hlen;      u16					ip_datalen; /*ip数据长度*/      double				rtt; /* 往返时间*/      struct timeval*sendtime;      ip = (struct iphdr *)recvbuf;      ip_hlen = ip->hlen << 2;      ip_datalen = ntohs(ip->tot_len) - ip_hlen;      icmp = (struct icmphdr *)(recvbuf + ip_hlen);      if(checksum((u8 *)icmp, ip_datalen)) /*计算校验和*/         return -1;  if(icmp->icmp_id != pid)  return -1;  	sendtime = (struct timeval *)icmp->data; /*发送时间*/  	rtt = ((&recvtime)->tv_sec - sendtime->tv_sec) * 1000 + ((&recvtime)->tv_usec - sendtime->tv_usec)/1000.0/* 往返时间*/  /*打印结果*/  printf("%d bytes from %s:icmp_seq=%u ttl=%d rtt=%.3f ms\n",  \			ip_datalen,/*IP数据长度*/  inet_ntoa(from.sin_addr),   /*目的ip地址*/  			icmp->icmp_seq,/*icmp报文序列号*/  			ip->ttl,/*生存时间*/  			rtt);/*往返时间*/  return 0;  }  /*设置信号处理程序*/  voidset_sighandler(){  	act_alarm.sa_handler = alarm_handler;  /*sigaction()会依参数signum指定的信号编号来设置该信号的处理函数。参数signum指所要捕获信号或忽略的信号,	&act代表新设置的信号共用体,NULL代表之前设置的信号处理结构体。这里判断对信号的处理是否成功。*/    if(sigaction(SIGALRM, &act_alarm, NULL) == -1)    {bail("SIGALRM handler setting fails.");  }	act_int.sa_handler = int_handler;      if(sigaction(SIGINT, &act_int, NULL) == -1)  {bail("SIGALRM handler setting fails.");  }}   /*统计ping命令的检测结果*/  voidget_statistics(int nsent,int nrecv){      printf("--- %s ping statistics ---\n",inet_ntoa(dest.sin_addr)); /*将网络地址转换成“.”点隔的字符串格式。*/      printf("%d packets transmitted, %d received, %0.0f%% ""packet loss\n",  \		nsent,nrecv,1.0*(nsent-nrecv)/nsent*100);  }  /*错误报告*/  voidbail(constchar * on_what){  /*:向指定的文件写入一个字符串(不写入字符串结束标记符‘\0’)。成功写入一个字符串后,	文件的位置指针会自动后移,函数返回值为0;否则返回EOR(符号常量,其值为-1)。*/     fputs(strerror(errno),stderr);       fputs(":",stderr);      fputs(on_what,stderr);      fputc('\n',stderr); /*送一个字符到一个流中*/      exit(1);  }   /*SIGINT(中断信号)处理程序*/  voidint_handler(int sig){  printf("Timer123 expired!\n");    get_statistics(nsent,nrecv);    /*统计ping命令的检测结果*/      close(sockfd);  /*关闭网络套接字*/      exit(1);  }   /*SIGALRM(终止进程)处理程序*/  voidalarm_handler(int signo){      send_ping();    /*发送ping消息*/  }

运行结果:

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-08-21 18:55:58 HTTP/2.0 GET : https://f.mffb.com.cn/a/508712.html
  2. 运行时间 : 0.290167s [ 吞吐率:3.45req/s ] 内存消耗:4,625.18kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=c7c97b92723de2ef228257e08d0fb6cc
  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.001135s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001534s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.006533s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.010354s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001456s ]
  6. SELECT * FROM `set` [ RunTime:0.000594s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001634s ]
  8. SELECT * FROM `article` WHERE `id` = 508712 LIMIT 1 [ RunTime:0.001262s ]
  9. UPDATE `article` SET `lasttime` = 1787309758 WHERE `id` = 508712 [ RunTime:0.018839s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 67 LIMIT 1 [ RunTime:0.030678s ]
  11. SELECT * FROM `article` WHERE `id` < 508712 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.001452s ]
  12. SELECT * FROM `article` WHERE `id` > 508712 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.001772s ]
  13. SELECT * FROM `article` WHERE `id` < 508712 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.019543s ]
  14. SELECT * FROM `article` WHERE `id` < 508712 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.006587s ]
  15. SELECT * FROM `article` WHERE `id` < 508712 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.012647s ]
0.293772s