update plugin docs and add some helper functions

This commit is contained in:
Jerry
2023-03-31 21:44:48 +08:00
committed by GitHub
parent f85719ac8b
commit baa6ce9fc1
10 changed files with 161 additions and 12 deletions

View File

@@ -397,3 +397,11 @@ public function testRoute(HttpRequestEvent $event)
$socket = ws_socket();
$socket->send('hello world', $event->getFd()); // 客户端的连接 fd 编号可以通过 WebSocketOpenEvent 等事件获取
```
### zm_create_app()
创建一个炸毛框架的单文件应用(仅单文件,项目外非编写插件模式时可用),效果等同于 `new \ZM\ZMApplication()`
### zm_create_plugin()
创建一个炸毛单文件模式的插件对象,效果等同于 `new \ZM\Plugin\ZMPlugin()`

View File

@@ -27,7 +27,7 @@
└── test-app/
├── main.php
├── empty/
└── zmplugin.json
└── composer.json
```
```php
@@ -36,7 +36,7 @@ $result = \ZM\Store\FileSystem::scanDirFiles('/home/ab/test/', true, false);
结果:
[
"/home/ab/test/test-app/main.php",
"/home/ab/test/test-app/zmplugin.json"
"/home/ab/test/test-app/composer.json"
]
*/
$result2 = \ZM\Store\FileSystem::scanDirFiles('/home/ab/test/', false, true, true);