snmp_get_quick_print

(PHP 4, PHP 5, PHP 7)

snmp_get_quick_print返回 UCD 库中 quick_print 设置的当前值

说明

bool snmp_get_quick_print ( void )

返回保存在 UCD 库中 quick_print 的当前值。默认情况下 quick_print 为 off。

Example #1 snmp_get_quick_print() 示例

<?php
  $quickprint 
snmp_get_quick_print();
?>

如果 quick_print 为 off,上边的函数调用将返回 FALSE,而如果 quick_print 为 on,则返回 TRUE

snmp_get_quick_print() 仅在使用了 UCD SNMP 库时才可用。当使用 Windows SNMP 库时,此函数不可用。

参见 snmp_set_quick_print() 查看 quick_print 的详细说明。

User Contributed Notes

antic 23-Feb-2003 02:13
This can be used to parse the returned values depending on the quick print setting. For example sysUpTime might look something like this: "Timeticks: (34575334) 4 days, 0:02:33.34", but if quick print is enabled it will be on the form: "4:0:2:33.34". To get the same output you can parse it differently, something like:

if(@ $sysUpTime = snmpget($switch,$community,"system.sysUpTime.0")){
    if(snmp_get_quick_print()){
       sscanf($sysUpTime, "%d:%d:%d:%d.%d",$day,$hour,$minute,$sec,$ticks);
        $sysUpTime = "$day days, $hour:$minute:$sec.$ticks";
    }else{
       $sysUpTime = ereg_replace("Timeticks: \([0-9]+\) ","",$sysUpTime);
   }
}