我使用TS框架通过PHP中的Teamspeak查询读取一些数据。但文件太可怕了!
要显示所有客户端的所有I,我使用以下代码:
foreach($ts3_VirtualServer->clientList() as $client)
{
// skip query clients
if($client["client_type"]) continue;
$clientInfo = $client->getInfo();
echo $clientInfo['connection_client_ip'] . "<br>";
} (这不是完整的代码)
说明getInfo()返回的内容的文档中的部分在哪里?
发布于 2018-04-28 21:26:45
它不在文档中,因为它对所有节点对象都是抽象/通用的。
正如您从摘要:getInfo()中看到的
if ($extend) {
$this->fetchNodeInfo();
}
if ($convert) {
$info = $this->nodeInfo;
foreach ($info as $key => $val) {
$key = TeamSpeak3_Helper_String::factory($key);
//...
}
return $info;
}
return $this->nodeInfo;返回的数据(格式化的或直接的)是TeamSpeak3_Node_Abstract::$nodeInfo。
搜索 GitHub repo for nodeInfo =展示了几个(子)节点如何设置其继承的nodeInfo属性。
例如,我们有主机::fetchNodeInfo(),它使用TeamSpeak3服务器查询命令hostinfo、instanceinfo返回的属性
protected function fetchNodeInfo() {
$info1 = $this->request("hostinfo")->toList();
$info2 = $this->request("instanceinfo")->toList();
$this->nodeInfo = array_merge($this->nodeInfo, $info1, $info2);
}另外,例如,服务器::fetchNodeInfo()使用serverinfo命令返回的属性:
protected function fetchNodeInfo() {
$this->nodeInfo = array_merge($this->nodeInfo,
$this->request("serverinfo")->toList());
}可以想象,几个TeamSpeak3对象有一个相应的*info命令,该命令返回该对象的属性。
您可以在TeamSpeak3服务器查询手册中查看这些命令的几个示例结果以及返回的属性。例如,这里的serverinfo命令。
此外,在手册的末尾,您可以找到几个对象属性列表。例如,虚拟服务器属性。
https://stackoverflow.com/questions/34628878
复制相似问题