PHP: Zookeeper::create - Manual


本站和网页 https://www.php.net/manual/zh/zookeeper.create.php 的作者无关,不对其内容负责。快照谨为网络故障时之索引,不代表被搜索网站的即时页面。

PHP: Zookeeper::create - Manual
Downloads
Documentation
Get Involved
Help
phpday 2023
Getting Started
Introduction
A simple tutorial
Language Reference
Basic syntax
Types
Variables
Constants
Expressions
Operators
Control Structures
Functions
Classes and Objects
Namespaces
Enumerations
Errors
Exceptions
Fibers
Generators
Attributes
References Explained
Predefined Variables
Predefined Exceptions
Predefined Interfaces and Classes
Predefined Attributes
Context options and parameters
Supported Protocols and Wrappers
Security
Introduction
General considerations
Installed as CGI binary
Installed as an Apache module
Session Security
Filesystem Security
Database Security
Error Reporting
User Submitted Data
Hiding PHP
Keeping Current
Features
HTTP authentication with PHP
Cookies
Sessions
Dealing with XForms
Handling file uploads
Using remote files
Connection handling
Persistent Database Connections
Command line usage
Garbage Collection
DTrace Dynamic Tracing
Function Reference
Affecting PHP's Behaviour
Audio Formats Manipulation
Authentication Services
Command Line Specific Extensions
Compression and Archive Extensions
Cryptography Extensions
Database Extensions
Date and Time Related Extensions
File System Related Extensions
Human Language and Character Encoding Support
Image Processing and Generation
Mail Related Extensions
Mathematical Extensions
Non-Text MIME Output
Process Control Extensions
Other Basic Extensions
Other Services
Search Engine Extensions
Server Specific Extensions
Session Extensions
Text Processing
Variable and Type Related Extensions
Web Services
Windows Only Extensions
XML Manipulation
GUI Extensions
Keyboard Shortcuts?
This help
Next menu item
Previous menu item
g p
Previous man page
g n
Next man page
Scroll to bottom
g g
Scroll to top
g h
Goto homepage
g s
Goto search(current page)
Focus search box
Zookeeper::delete »
« Zookeeper::__construct
PHP 手册 函数参考 其它服务 ZooKeeper Zookeeper
Change language:
English
Brazilian Portuguese
Chinese (Simplified)
French
German
Japanese
Russian
Spanish
Turkish
Other
Submit a Pull Request
Report a Bug
Zookeeper::create
(PECL zookeeper >= 0.1.0)Zookeeper::create — Create a node synchronously
说明
public
Zookeeper::create( string $path, string $value, array $acls, int $flags = null): string
This method will create a node in ZooKeeper. A node can only be created if it does not already exists. The Create Flags affect the creation of nodes. If ZOO_EPHEMERAL flag is set, the node will automatically get removed if the client session goes away. If the ZOO_SEQUENCE flag is set, a unique monotonically increasing sequence number is appended to the path name.
参数
path
The name of the node. Expressed as a file name with slashes separating ancestors of the node.
value
The data to be stored in the node.
acls
The initial ACL of the node. The ACL must not be null or empty.
flags
this parameter can be set to 0 for normal create or an OR of the Create Flags
返回值
Returns the path of the new node (this might be different than the supplied path because of the ZOO_SEQUENCE flag) on success, and false on failure.
错误/异常
This method emits PHP error/warning when parameters count or types are wrong or fail to create node.
警告
Since version 0.3.0, this method emits ZookeeperException and it's derivatives.
范例
示例 #1 Zookeeper::create() example
Create a new node.
<?php$zookeeper = new Zookeeper('locahost:2181');$aclArray = array( array( 'perms' => Zookeeper::PERM_ALL, 'scheme' => 'world', 'id' => 'anyone', ));$path = '/path/to/newnode';$realPath = $zookeeper->create($path, null, $aclArray);if ($realPath) echo $realPath;else echo 'ERR';?>
以上例程会输出:
/path/to/newnode
参见
Zookeeper::delete() - Delete a node in zookeeper synchronously
Zookeeper::getChildren() - Lists the children of a node synchronously
ZooKeeper Permissions
ZookeeperException
+add a note
User Contributed Notes
There are no user contributed notes for this page.
Zookeeper
addAuth
close
connect
_&#8203;_&#8203;construct
create
delete
exists
get
getAcl
getChildren
getClientId
getConfig
getRecvTimeout
getState
isRecoverable
set
setAcl
setDebugLevel
setDeterministicConnOrder
setLogStream
setWatcher
Copyright 2001-2022 The PHP Group
My PHP.net
Contact
Other PHP.net sites
Privacy policy