ZooKeeper Zookeeper::getChildren

(PECL zookeeper >= 0.1.0)

Zookeeper::getChildren — 노드의 자식을 동기적으로 나열합니다.


설명

public Zookeeper::getChildren(string $path, callable $watcher_cb = null): array


매개변수

path
노드의 이름입니다. 노드의 상위 항목을 구분하는 슬래시가 있는 파일 이름으로 표현됩니다.
watcher_cb
0이 아니면 노드가 변경되면 클라이언트에 알리기 위해 서버에서 감시가 설정됩니다.

반환 값

성공하면 자식 경로가 있는 배열을 반환하고 실패하면 false를 반환합니다.


오류/예외

이 메소드는 매개변수 개수 또는 유형이 잘못되었거나 노드의 자식을 나열하지 못하는 경우 PHP 오류/경고를 표시합니다.

주의 버전 0.3.0부터 이 메소드는 ZookeeperException과 파생 상품을 내보냅니다.


Examples

예제 #1 zookeeper::getChildren() 예제

노드의 자식을 나열합니다.

                  
<?php
$zookeeper = new Zookeeper('locahost:2181');
$path = '/zookeeper';
$r = $zookeeper->getchildren($path);
if ($r)
  var_dump($r);
else
  echo 'ERR';
?>
                  
                

위의 예는 다음을 출력합니다.

array(1) {
  [0]=>
  string(6) "config"
}
                

기타