本文整理汇总了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;
}