當前位置: 首頁>>代碼示例>>PHP>>正文


PHP fs_director::CheckForNullValue方法代碼示例

本文整理匯總了PHP中fs_director::CheckForNullValue方法的典型用法代碼示例。如果您正苦於以下問題:PHP fs_director::CheckForNullValue方法的具體用法?PHP fs_director::CheckForNullValue怎麽用?PHP fs_director::CheckForNullValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在fs_director的用法示例。


在下文中一共展示了fs_director::CheckForNullValue方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: ServerUptime

 /**
  * Returns a nice human readable copy of the server uptime.
  * @author Bobby Allen (ballen@bobbyallen.me)
  * @return string Human readable server uptime.
  */
 static function ServerUptime()
 {
     if (sys_versions::ShowOSPlatformVersion() == "Linux") {
         $uptime = trim(exec("cat /proc/uptime"));
         $uptime = explode(" ", $uptime);
         $uptime = $uptime[0];
         $day = 86400;
         $days = floor($uptime / $day);
         $utdelta = $uptime - $days * $day;
         $hour = 3600;
         $hours = floor($utdelta / $hour);
         $utdelta -= $hours * $hour;
         $minute = 60;
         $minutes = floor($utdelta / $minute);
         $days = fs_director::CheckForNullValue($days != 1, $days . ' days', $days . ' day');
         $hours = fs_director::CheckForNullValue($hours != 1, $hours . ' hours', $hours . ' hour');
         $minutes = fs_director::CheckForNullValue($minutes != 1, $minutes . ' minutes', $minutes . ' minute');
         $retval = $days . ", " . $hours . ", " . $minutes . "";
     } elseif (sys_versions::ShowOSPlatformVersion() == "Windows") {
         $pagefile = "C:\\pagefile.sys";
         $upsince = filemtime($pagefile);
         $gettime = time() - filemtime($pagefile);
         $days = floor($gettime / (24 * 3600));
         $gettime = $gettime - $days * (24 * 3600);
         $hours = floor($gettime / 3600);
         $gettime = $gettime - $hours * 3600;
         $minutes = floor($gettime / 60);
         $gettime = $gettime - $minutes * 60;
         $seconds = $gettime;
         $days = fs_director::CheckForNullValue($days != 1, $days . ' days', $days . ' day');
         $hours = fs_director::CheckForNullValue($hours != 1, $hours . ' hours', $hours . ' hour');
         $minutes = fs_director::CheckForNullValue($minutes != 1, $minutes . ' minutes', $minutes . ' minute');
         $retval = $days . ", " . $hours . ", " . $minutes . "";
     } elseif (sys_versions::ShowOSPlatformVersion() == "MacOSX") {
         $uptime = explode(" ", exec("sysctl -n kern.boottime"));
         $uptime = str_replace(",", "", $uptime[3]);
         $uptime = time() - $uptime;
         $min = $uptime / 60;
         $hours = $min / 60;
         $days = floor($hours / 24);
         $hours = floor($hours - $days * 24);
         $minutes = floor($min - $days * 60 * 24 - $hours * 60);
         $days = fs_director::CheckForNullValue($days != 1, $days . ' days', $days . ' day');
         $hours = fs_director::CheckForNullValue($hours != 1, $hours . ' hours', $hours . ' hour');
         $minutes = fs_director::CheckForNullValue($minutes != 1, $minutes . ' minutes', $minutes . ' minute');
         $retval = $days . ", " . $hours . ", " . $minutes . "";
     } elseif (sys_versions::ShowOSPlatformVersion() == "FreeBSD") {
         $uptime = explode(" ", exec("/sbin/sysctl -n kern.boottime"));
         $uptime = str_replace(",", "", $uptime[3]);
         $uptime = time() - $uptime;
         $min = $uptime / 60;
         $hours = $min / 60;
         $days = floor($hours / 24);
         $hours = floor($hours - $days * 24);
         $minutes = floor($min - $days * 60 * 24 - $hours * 60);
         $days = fs_director::CheckForNullValue($days != 1, $days . ' days', $days . ' day');
         $hours = fs_director::CheckForNullValue($hours != 1, $hours . ' hours', $hours . ' hour');
         $minutes = fs_director::CheckForNullValue($minutes != 1, $minutes . ' minutes', $minutes . ' minute');
         $retval = $days . ", " . $hours . ", " . $minutes . "";
     } else {
         $retval = "Unsupported OS";
     }
     return $retval;
 }
開發者ID:TGates71,項目名稱:Sentora-Windows-Upgrade,代碼行數:69,代碼來源:monitoring.class.php


注:本文中的fs_director::CheckForNullValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。