array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'function.snmp-set-valueretrieval.php', 1 => 'snmp_set_valueretrieval', ), 'up' => array ( 0 => 'ref.snmp.php', 1 => 'SNMP 関数', ), 'prev' => array ( 0 => 'function.snmp-set-quick-print.php', 1 => 'snmp_set_quick_print', ), 'next' => array ( 0 => 'function.snmp2-get.php', 1 => 'snmp2_get', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ja', 'path' => 'reference/snmp/functions/snmp-set-valueretrieval.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4 >= 4.3.3, PHP 5, PHP 7, PHP 8)
snmp_set_valueretrieval — SNMP の値が返される方法を設定する
method
SNMP_VALUE_LIBRARY | Net-SNMP ライブラリの返す形式のままで返します。 |
SNMP_VALUE_PLAIN | SNMP の型情報を含まないプレーンな値を返します。 |
SNMP_VALUE_OBJECT |
プロパティ value
および type をもつオブジェクトを返します。
type は SNMP_OCTET_STR
や SNMP_COUNTER
などの定数のいずれかとなります。
value を返す方法は、定数
SNMP_VALUE_LIBRARY ,
SNMP_VALUE_PLAIN
のどちらが設定されているかによって決まります。
|
常に true
を返します。
例1 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
// )
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
// )
?>