search

Home  >  Q&A  >  body text

php - How to get the delay ms of the website

I have never seen this before. The boss suddenly said that he would add a delay speed of ms to display the website on the page. I haven't found any useful information after Baidu for a long time. I would like to ask some experts to tell me how to achieve it.

仅有的幸福仅有的幸福2797 days ago423

reply all(1)I'll reply

  • phpcn_u1582

    phpcn_u15822017-05-16 12:59:55

    if (strcasecmp(PHP_OS, 'WINNT') === 0) {
        // Windows 服务器下
        $pingresult = exec("ping -n 1 {$address}", $outcome, $status);
    } elseif (strcasecmp(PHP_OS, 'Linux') === 0) {
        // Linux 服务器下
        $pingresult = exec("ping -c 1 {$address}", $outcome, $status);
    }  

    reply
    0
  • Cancelreply