略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: SNMP::setSecurity

2024-12-23

SNMP::setSecurity

(PHP 5 >= 5.4.0, PHP 7, PHP 8)

SNMP::setSecurityConfigures security-related SNMPv3 session parameters

说明

public SNMP::setSecurity(
    string $securityLevel,
    string $authProtocol = "",
    string $authPassphrase = "",
    string $privacyProtocol = "",
    string $privacyPassphrase = "",
    string $contextName = "",
    string $contextEngineId = ""
): bool

setSecurity configures security-related session parameters used in SNMP protocol version 3

参数

securityLevel

the security level (noAuthNoPriv|authNoPriv|authPriv)

authProtocol

the authentication protocol (MD5 or SHA)

authPassphrase

the authentication pass phrase

privacyProtocol

the privacy protocol (DES or AES)

privacyPassphrase

the privacy pass phrase

contextName

the context name

contextEngineId

the context EngineID

返回值

成功时返回 true, 或者在失败时返回 false

范例

示例 #1 SNMP::setSecurity() example

<?php
  $session 
= new SNMP(SNMP::VERSION_3$hostname$rwuser$timeout$retries);
  
$session->setSecurity('authPriv''MD5'$auth_pass'AES'$priv_pass'''aeeeff');
?>

参见

add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/snmp.setsecurity.php

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