作者:accera_928 | 来源:互联网 | 2023-05-18 04:24
期望的事workerstart中捕获到继承接口参数确实这个错误,但是没有捕获到server.php1234567891011121314151617181920212223class server{
期望的事workerstart中捕获到继承接口参数确实这个错误,但是没有捕获到
server.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| class server{
public function onWorkerStart($server,$rid){
try{
include "./class.php";
}catch(\Exception $e){
var_dump($e->getMessage());
}catch(\throwable $e){
var_dump($e->getMessage());
}
}
public function onReceive($server,$fd,$rid,$data){
}
}
$serv = new \Swoole\Server("0.0.0.0",9501);
$serv->set([
'worker_num' => 3,
'daemonize' => false,
]);
$server = new server;
$serv->on('workerStart',[$server,'onWorkerStart']);
$serv->on('receive',[$server,'onReceive']);
$serv->start(); |
class.php
1 2 3 4 5 6 7 8 9 10 11
|
interface IT {
public function run(array $conf);
}
class ITT implements IT {
public function run(){
echo 1;
}
}
|
问题出现的环境背景及自己尝试过哪些方法
相关代码
// 请把代码文本粘贴到下方(请勿用图片代替代码)
你期待的结果是什么?实际看到的错误信息又是什么?