snmp_set_valueretrieval

(PHP 4 >= 4.3.3, PHP 5, PHP 7)

snmp_set_valueretrieval Specify the method how the SNMP values will be returned

说明

snmp_set_valueretrieval ( int $method = SNMP_VALUE_LIBRARY ) : bool

参数

method
types
SNMP_VALUE_LIBRARY The return values will be as returned by the Net-SNMP library.
SNMP_VALUE_PLAIN The return values will be the plain value without the SNMP type hint.
SNMP_VALUE_OBJECT The return values will be objects with the properties "value" and "type", where the latter is one of the SNMP_OCTET_STR, SNMP_COUNTER etc. constants. The way "value" is returned is based on which one of constants SNMP_VALUE_LIBRARY, SNMP_VALUE_PLAIN is set.

范例

Example #1 Using snmp_set_valueretrieval()

<?php
 snmp_set_valueretrieval
(SNMP_VALUE_LIBRARY);
 
$ret snmpget('localhost''public''IF-MIB::ifName.1');
 
// $ret = "STRING: lo"

 
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
 
$ret snmpget('localhost''public''IF-MIB::ifName.1');
 
// $ret = "lo";

 
snmp_set_valueretrieval(SNMP_VALUE_OBJECT);
 
$ret snmpget('localhost''public''IF-MIB::ifName.1');
 
// stdClass Object
 // (
 //   [type] => 4        <-- SNMP_OCTET_STR, see constants
 //   [value] => lo
 // )

 // PHP 5.4+ examples
 
snmp_set_valueretrieval(SNMP_VALUE_OBJECT SNMP_VALUE_PLAIN);
 
$ret snmpget('localhost''public''IF-MIB::ifName.1');
 
// stdClass Object
 // (
 //   [type] => 4        <-- SNMP_OCTET_STR, see constants
 //   [value] => lo
 // )

 
snmp_set_valueretrieval(SNMP_VALUE_OBJECT SNMP_VALUE_LIBRARY);
 
$ret snmpget('localhost''public''IF-MIB::ifName.1');
 
// stdClass Object
 // (
 //   [type] => 4        <-- SNMP_OCTET_STR, see constants
 //   [value] => STRING: lo
 // )

?>

更新日志

版本 说明
5.4.0

Constants SNMP_VALUE_PLAIN or SNMP_VALUE_LIBRARY may be combined with SNMP_VALUE_OBJECT resulting different way of representing contents of value array element in return value of GET-function. If no SNMP_VALUE_{PLAIN,LIBRARY} constant is accompanying SNMP_VALUE_OBJECT, SNMP_VALUE_LIBRARY is used.

Prior to 5.4.0 SNMP_VALUE_OBJECT effecively meant SNMP_VALUE_OBJECT|SNMP_VALUE_PLAIN.

参见

相关文章
php evstat returns the previous set of values returned by evstat attrphp gettext 函数 specify the character encoding in which the messages from the domain message catalog will be returnedphp classkit 函数 dynamically changes the code of the given methodphp db++ 函数 specify new primary key for a relationphp enchant 函数 will return a list of values if any of those pre conditions are not metphp fdf 函数 adds javascript code to be executed when acrobat opens the fdfphp firebird/interbase 函数 wait for an event to be posted by the databasephp ingres 函数 get the number of rows affected or returned by a queryphp runkit 函数 determines if the current functions return value will be usedphp snmp 函数 return the method how the snmp values will be returnedphp snmp 函数 return all values that are enums with their enum value instead of the raw integerphp snmp 函数 specify the method how the snmp values will be returnedphp snmp 函数 fetch the snmp object which follows the given object idphp snmp 函数 return all objects including their respective object id within the specified onephp statistic 函数 calculates any one parameter of the cauchy distribution given values for the othersphp statistic 函数 calculates any one parameter of the chi square distribution given values for the othersphp svn 函数 creates and returns a stream that will be used to replacephp solrquery returns the maximum number of constraint counts that should be returned for the facet fieldsphp solrquery returns the list of fields that will be returned in the responsephp solrquery returns the treshold frequency at which words will be ignored which do not occur in at least this many docs
关注编程学问公众号