当前位置: 首页 > 工具软件 > Webman > 使用案例 >

PHP的webman内存溢出,关于webman文档的疑问

东方骏
2023-12-01

不然start.php中 如下代码不会起作用

foreach ($config['services'] ?? [] as $server) {

if (!class_exists($server['handler'])) {

echo "process error: class {$config['handler']} not exists\r\n";

continue;

}

$listen = new Worker($server['listen'] ?? null, $server['context'] ?? []);

if (isset($server['listen'])) {

echo "listen: {$server['listen']}\n";

}

$class = Container::make($server['handler'], $server['constructor'] ?? []);

worker_bind($listen, $class);

$listen->listen();

}

process.php

use support\view\Raw;

use support\view\Twig;

use support\view\Blade;

use support\view\ThinkPHP;

return [

// 文件更新检测

'monitor' => [

'handler' => process\FileMonitor::class,

'constructor' => [

// 监控这些目录

'monitor_dir' => [

app_path(),

config_path(),

base_path() . '/process',

base_path() . '/support',

base_path() . '/resource'

],

// 监控这些后缀的文件

'monitor_extenstions' => [

'php', 'html', 'htm'

]

],

'services'=>[ //注意这里

[

'handler' => process\Test::class,

'listen' => "http://127.0.0.1:8090",

],

]

],

// 其它进程

/*'websocket' => [

'handler' => process\Websocket::class,

'listen' => 'websocket://0.0.0.0:8888',

'count' => 10,

],*/

];

 类似资料: