函数名称:radius_request_authenticator()
适用版本:PHP 4, PHP 5, PHP 7
函数描述:radius_request_authenticator() 函数用于获取一个 RADIUS 请求的认证器(Authenticator),该认证器用于验证 RADIUS 服务器发送的回应。
用法:
string radius_request_authenticator(resource $radius_handle)
参数:
- $radius_handle:RADIUS 连接句柄,通过 radius_auth_open() 函数获得的句柄。
返回值:
- 返回一个包含认证器的字符串,如果失败则返回 FALSE。
示例:
// 创建一个 RADIUS 连接句柄
$radius_handle = radius_auth_open();
// 连接到 RADIUS 服务器
radius_add_server($radius_handle, 'radius.example.com', 1812, 'shared_secret', 5, 3);
// 发送一个 RADIUS 认证请求
if (radius_create_request($radius_handle, RADIUS_ACCESS_REQUEST)) {
// 获取请求的认证器
$authenticator = radius_request_authenticator($radius_handle);
if ($authenticator !== FALSE) {
echo "请求的认证器:$authenticator";
} else {
echo "获取认证器失败";
}
} else {
echo "创建请求失败";
}
// 关闭 RADIUS 连接句柄
radius_close($radius_handle);
注意事项:
- 在调用 radius_request_authenticator() 函数之前,必须先调用 radius_create_request() 函数创建一个 RADIUS 请求。
- 该函数只能在 RADIUS 认证请求发送之后调用,用于获取服务器回应中的认证器。
- 认证器是一个用于验证服务器回应的重要参数,可用于确保回应的合法性和完整性。