略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: snmp_get_quick_print

2024-11-22

snmp_get_quick_print

(PHP 4, PHP 5, PHP 7, PHP 8)

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

说明

snmp_get_quick_print(): bool

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

示例 #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 的详细说明。

add a noteadd a note

User Contributed Notes 1 note

up
-6
antic
19 years ago
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);
   }
}

官方地址:https://www.php.net/manual/en/function.snmp-get-quick-print.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3