Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
modified:   README.md
modified:   docs/phpx.md
deleted:    docs/zh/1.directory.md
deleted:    docs/zh/4.api.md
new file:   docs/zh/Api.md
new file:   docs/zh/README.md
modified:   docs/zookeeper.md
modified:   examples/acl.php
  • Loading branch information
sy-records committed Sep 24, 2019
1 parent 1712687 commit b42eee4
Show file tree
Hide file tree
Showing 8 changed files with 177 additions and 173 deletions.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
- [x] delete
- [x] exists
- [x] getAcl
- [ ] setAcl
- [x] setAcl
- [x] getState
- [x] getClientId

Expand All @@ -41,15 +41,14 @@ phpx install
安装过程中可能遇到的问题
----

1. 安装完成后,执行 *php test/test.php* 报找不到 swoole\zookeeper 类
1. 安装完成后,执行 `php test/test.php` 报找不到 `swoole\zookeeper`

执行 *php -i | grep php.ini* 找到配置文件的位置,在 php.ini 中动态扩展配置区加入 **extension=swoole_zookeeper.so**
执行 `php -i | grep php.ini` 找到配置文件的位置,在 `php.ini` 中动态扩展配置区加入 `extension=swoole_zookeeper.so`

2. 出现这种错误 `Unable to load dynamic library '/usr/lib64/php/modules/cpp_ext.so' - libphpx.so: cannot open shared object file: No such file or directory in Unknown on line 0`

说明 PHP-X 没有安装成功,请重新安装 PHP-X
说明 `PHP-X` 没有安装成功,请重新安装 `PHP-X`

3. 执行 *phpx build -v -d*,出现 `fatal error: swoole/include/socket_hook.h No such file or directory`
3. 执行 `phpx build -v -d`,出现 `fatal error: swoole/include/socket_hook.h No such file or directory`

请重新安装编译安装 swoole

请重新安装编译安装 `Swoole`
87 changes: 49 additions & 38 deletions docs/phpx.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,76 @@
### 安装环境

ubuntu18.04

### 1.下载安装包

https://github.com/swoole/phpx

### 2.安装composer

```shell
#下载composer可执行文件
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
#执行安装文件
php composer-setup.php
#删除安装文件
php -r "unlink('composer-setup.php');"
#移动 composer.phar 可以进行全局调用
mv composer.phar /usr/local/bin/composer
```

wget https://pecl.php.net/get/phar-2.0.0.tgz

mv composer.phar composer

chmod +x composer

sudo mv composer /usr/local/bin

### 3.注意

最好把phpize 和 php-config都丢到/usr/bin里防止找不到

### 4.运行phpx下的shell
最好把 `phpize``php-config` 都丢到 `/usr/bin` 里防止找不到

首先进入到phpx的目录
### 4.运行phpx下的shell

执行shell
首先进入到 `phpx` 的目录,执行 `shell`

./build.sh
```shell
./build.sh
```

cmake解析

cmake .


```
cmake .
```

编译

make -j 4

```
make -j 4
```

安装

sudo make install


```
sudo make install
```

导入动态库

sudo ldconfig

将bin目录下的二进制文件copy入/usr/bin下面

sudo cp bin/phpx /usr/bin/phpx

运行phpx
```
sudo ldconfig
```

`bin` 目录下的二进制文件 `copy``/usr/bin` 下面

```
sudo cp bin/phpx /usr/bin/phpx
```

运行 `phpx`

zhanglei@zhanglei-OptiPlex-9020:~/ourc/phpx-master$ phpx
```shell
zhanglei@zhanglei-OptiPlex-9020:~/ourc/phpx-master$ phpx

PHP-X Console Tool 0.0.1

Usage:
command [options] [arguments]

Options:
-h, --help Display this help message
-q, --quiet Do not output any message
Expand All @@ -68,7 +81,7 @@ cmake解析
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
build Build phpx project
clean Clean object files
Expand All @@ -78,6 +91,4 @@ cmake解析
list Lists commands
run Run phpx project
zhanglei@zhanglei-OptiPlex-9020:~/ourc/phpx-master$



```
32 changes: 0 additions & 32 deletions docs/zh/1.directory.md

This file was deleted.

60 changes: 0 additions & 60 deletions docs/zh/4.api.md

This file was deleted.

45 changes: 45 additions & 0 deletions docs/zh/Api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
## API文档

### __construct(string $host, int $recv_timeout)

初始化一个新的句柄和一个新的 `zookeeper` 会话响应句柄。会话处理是异步的,意味着会话只有收到状态为 `ZOO_CONNECTED_STATE` 的事件才会建立。

#### 参数

* host

逗号分隔的 `host:port`,每个对应一个 `zookeeper` 服务。
示例 `"127.0.0.1:3000,127.0.0.1:3001,mysq.zookeeper.com:3002"`

* recv_timeout

会话的超时时间(秒数),仅在连接是当前已连接时有效。

#### 返回值

成功返回 `0`,失败返回异常码。

### get(string $path)

获取与节点关联的数据

#### 参数

* path

节点名称
示例`"/zoo/tiger"`

### set(string $path, string $value)

为指定节点设置数据

#### 参数

* path

节点名称

* value

要设置的数据
34 changes: 34 additions & 0 deletions docs/zh/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# ZooKeeper协程扩展

## 1.目录

## 2.入门指引

- 简介
- 简明教程

## 3.安装

- 先决条件
- 下载
- 安装
- Mac OS
- Linux
- Windows

## 4.API文档

- [__construct](Api.md#__constructstring-host-int-recv_timeout) - 构造函数
- [get](Api.md#getstring-path) - 从特定的znode获取数据
- exists - 检查路径中是否存在znode
- create - 创建znode
- [set](Api.md#setstring-path-string-value) - 在特定的znode中设置数据
- delete - 删除特定的znode及其所有子项
- setDebugLevel - 设置debug等级
- getAcl - 读取ACL权限
- getChildren - 获取特定znode中的所有子节点
- multi - 对znodes进行批量更新
- addAuth - 添加认证用户
- setAcl - 设置ACL权限

## 5.常见问题
Loading

0 comments on commit b42eee4

Please sign in to comment.