本文整理汇总了PHP中doCmdT函数的典型用法代码示例。如果您正苦于以下问题:PHP doCmdT函数的具体用法?PHP doCmdT怎么用?PHP doCmdT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了doCmdT函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execCmds
function execCmds()
{
global $commands;
for ($i = 0; isset($commands[$i]); $i++) {
doCmdT($commands[$i][0], $commands[$i][1]);
}
}
示例2: array
$commands = array();
defCmdT("summary", "OpenBGPD Summary", "/usr/local/sbin/bgpctl show summary");
defCmdT("interfaces", "OpenBGPD Interfaces", "/usr/local/sbin/bgpctl show interfaces");
defCmdT("routing", "OpenBGPD Routing", "/usr/local/sbin/bgpctl show rib", true, 4);
defCmdT("forwarding", "OpenBGPD Forwarding", "/usr/local/sbin/bgpctl show fib", true, 5);
defCmdT("network", "OpenBGPD Network", "/usr/local/sbin/bgpctl show network");
defCmdT("nexthops", "OpenBGPD Nexthops", "/usr/local/sbin/bgpctl show nexthop");
defCmdT("ip", "OpenBGPD IP", "/usr/local/sbin/bgpctl show ip bgp", true, 4);
defCmdT("neighbors", "OpenBGPD Neighbors", "/usr/local/sbin/bgpctl show neighbor");
if (isset($_REQUEST['isAjax'])) {
if (isset($_REQUEST['cmd']) && isset($commands[$_REQUEST['cmd']])) {
echo "{$_REQUEST['cmd']}\n";
if (isset($_REQUEST['count'])) {
echo " of " . countCmdT($commands[$_REQUEST['cmd']]['command']) . " items";
} else {
echo htmlspecialchars_decode(doCmdT($commands[$_REQUEST['cmd']]['command'], $_REQUEST['limit'], $_REQUEST['filter'], $_REQUEST['header_size']));
}
}
exit;
}
$pgtitle = array("OpenBGPD", "Status");
include "head.inc";
function doCmdT($command, $limit = "all", $filter = "", $header_size = 0)
{
$grepline = "";
if (!empty($filter)) {
$ini = $header_size > 0 ? $header_size + 1 : 1;
$grepline = " | /usr/bin/sed -e '{$ini},\$ { /" . escapeshellarg(htmlspecialchars($filter)) . "/!d; };'";
}
if (is_numeric($limit) && $limit > 0) {
$limit += $header_size;