本文整理汇总了PHP中Result::sec2hms方法的典型用法代码示例。如果您正苦于以下问题:PHP Result::sec2hms方法的具体用法?PHP Result::sec2hms怎么用?PHP Result::sec2hms使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Result
的用法示例。
在下文中一共展示了Result::sec2hms方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: strtotime
$oldStatus = "<font style='color:#04B486'>Online</font>";
$newStatus = "<font style='color:#DF0101'>Offline</font>";
} else {
$oldStatus = "<font style='color:#DF0101'>Offline</font>";
$newStatus = "<font style='color:#04B486'>Online</font>";
}
//set subnet
$subnet = $Subnets->fetch_subnet(null, $change['subnetId']);
//ago
if (is_null($change['lastSeen']) || $change['lastSeen'] == "1970-01-01 00:00:01" || $change['lastSeen'] == "0000-00-00 00:00:00") {
$ago = "never";
} else {
$timeDiff = $now - strtotime($change['lastSeen']);
// reformat
$lastSeen = date("m/d H:i", strtotime($change['lastSeen']));
$ago = $lastSeen . " (" . $Result->sec2hms($timeDiff) . " ago)";
}
// desc
$change['description'] = strlen($change['description']) > 0 ? "{$Subnets->mail_font_style} {$change['description']}</font>" : "{$Subnets->mail_font_style} / </font>";
// subnet desc
$subnet->description = strlen($subnet->description) > 0 ? "{$Subnets->mail_font_style} {$subnet->description}</font>" : "{$Subnets->mail_font_style} / </font>";
//content
$content[] = "<tr>";
$content[] = "\t<td style='padding:3px 8px;border:1px solid #ccc;'><a href='" . rtrim(str_replace(BASE, "", $Scan->settings->siteURL), "/") . "" . create_link("subnets", $subnet->sectionId, $subnet->id) . "'>{$Subnets->mail_font_style_href} " . $Subnets->transform_to_dotted($change['ip_addr']) . "</font></a></td>";
$content[] = "\t<td style='padding:3px 8px;border:1px solid #ccc;'>{$Subnets->mail_font_style} {$change['description']}</font></td>";
$content[] = "\t<td style='padding:3px 8px;border:1px solid #ccc;'>{$Subnets->mail_font_style_href} {$change['dns_name']}</font></td>";
$content[] = "\t<td style='padding:3px 8px;border:1px solid #ccc;'><a href='" . rtrim(str_replace(BASE, "", $Scan->settings->siteURL), "/") . "" . create_link("subnets", $subnet->sectionId, $subnet->id) . "'>{$Subnets->mail_font_style_href} " . $Subnets->transform_to_dotted($subnet->subnet) . "/" . $subnet->mask . "</font></a>" . $subnet->description . "</td>";
$content[] = "\t<td style='padding:3px 8px;border:1px solid #ccc;'>{$Subnets->mail_font_style} {$ago}</td>";
$content[] = "\t<td style='padding:3px 8px;border:1px solid #ccc;'>{$Subnets->mail_font_style} {$oldStatus} > {$newStatus}</td>";
$content[] = "</tr>";
//plain content
示例2: time
$oldStatus = "<font style='color:#04B486'>Online</font>";
$newStatus = "<font style='color:#DF0101'>Offline</font>";
} else {
$oldStatus = "<font style='color:#DF0101'>Offline</font>";
$newStatus = "<font style='color:#04B486'>Online</font>";
}
//set subnet
$subnet = $Subnets->fetch_subnet(null, $change['subnetId']);
//set section
$section = $Tools->fetch_object("sections", "id", $subnet->sectionId);
//ago
if (is_null($change['lastSeen']) || $change['lastSeen'] == "0000-00-00 00:00:00") {
$ago = "never";
} else {
$timeDiff = time() - strtotime($change['lastSeen']);
$ago = $change['lastSeen'] . " (" . $Result->sec2hms($timeDiff) . " ago)";
}
//content
$content[] = "<tr>";
$content[] = "\t<td style='padding:3px 8px;border:1px solid silver;'><a href='" . rtrim($Scan->settings->siteURL, "/") . "" . create_link("subnets", $section->id, $subnet->id) . "'>" . $Subnets->transform_to_dotted($change['ip_addr']) . "</a></td>";
$content[] = "\t<td style='padding:3px 8px;border:1px solid silver;'>{$change['description']}</td>";
$content[] = "\t<td style='padding:3px 8px;border:1px solid silver;'><a href='" . rtrim($Scan->settings->siteURL, "/") . "" . create_link("subnets", $section->id, $subnet->id) . "'>" . $Subnets->transform_to_dotted($subnet->subnet) . "/" . $subnet->mask . " - " . $subnet->description . "</a></td>";
$content[] = "\t<td style='padding:3px 8px;border:1px solid silver;'><a href='" . rtrim($Scan->settings->siteURL, "/") . "" . create_link("subnets", $section->id) . "'>{$section->name} {$section->description}</a></td>";
$content[] = "\t<td style='padding:3px 8px;border:1px solid silver;'>{$ago}</td>";
$content[] = "\t<td style='padding:3px 8px;border:1px solid silver;'>{$oldStatus}</td>";
$content[] = "\t<td style='padding:3px 8px;border:1px solid silver;'>{$newStatus}</td>";
$content[] = "</tr>";
//plain content
$content_plain[] = "\t * " . $Subnets->transform_to_dotted($change['ip_addr']) . " (" . $Subnets->transform_to_dotted($subnet->subnet) . "/" . $subnet->mask . ")\r\n \t " . strip_tags($oldStatus) . " => " . strip_tags($newStatus);
}
$content[] = "</table>";