【已解决】如何判断当前进程是否是http进程中 我要是request类,在自定义类会报错

tanhongbin

使用request() 直接报错
[2025-01-08 18:01:11] [INFO] TypeError: Illegal offset type in D:\phpstudy_pro\WWW\webman\vendor\workerman\webman-framework\src\Context.php:65
Stack trace:

0 D:\phpstudy_pro\WWW\webman\vendor\workerman\webman-framework\src\Context.php(92): Webman\Context::getObject()

1 D:\phpstudy_pro\WWW\webman\app\functions.php(365): Webman\Context::get('request')

2 D:\phpstudy_pro\WWW\webman\app\queue\consumer\redis\TableFieldSync.php(26): isHttpRequest()

3 D:\phpstudy_pro\WWW\webman\vendor\thb\redis\src\RedisClient.php(265): app\queue\consumer\redis\TableFieldSync->consume(Array)

4 D:\phpstudy_pro\WWW\webman\vendor\thb\redis\src\Redislication.php(22): Thb\Redis\RedisClient->Thb\Redis{closure}()

5 D:\phpstudy_pro\WWW\webman\lib\ListenIo.php(42): Thb\Redis\Redislication->Thb\Redis{closure}(Array)

6 D:\phpstudy_pro\WWW\webman\app\queue\middleware\QueueRedisLog.php(22): lib\ListenIo->queueLog(Array, Object(Closure), 'redis')

7 D:\phpstudy_pro\WWW\webman\vendor\thb\redis\src\Redislication.php(28): app\queue\middleware\QueueRedisLog->process(Array, Object(Closure))

8 D:\phpstudy_pro\WWW\webman\vendor\thb\redis\src\Redislication.php(32): Thb\Redis\Redislication->Thb\Redis{closure}(Array)

9 D:\phpstudy_pro\WWW\webman\vendor\thb\redis\src\RedisClient.php(278): Thb\Redis\Redislication->handle(Array, Object(Closure))

10 D:\phpstudy_pro\WWW\webman\vendor\workerman\redis\src\Client.php(421): Thb\Redis\RedisClient->Thb\Redis{closure}(Array, Object(Workerman\Redis\Client))

11 D:\phpstudy_pro\WWW\webman\vendor\workerman\workerman\src\Connection\TcpConnection.php(749): Workerman\Redis\Client->Workerman\Redis{closure}(Object(Workerman\Connection\AsyncTcpConnection), Array)

12 D:\phpstudy_pro\WWW\webman\vendor\workerman\workerman\src\Events\Revolt.php(147): Workerman\Connection\TcpConnection->baseRead(Resource id #363)

13 D:\phpstudy_pro\WWW\webman\vendor\revolt\event-loop\src\EventLoop\Internal\AbstractDriver.php(591): Workerman\Events\Revolt::Workerman\Events{closure}('i', Resource id #363)

14 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal{closure}()

15 D:\phpstudy_pro\WWW\webman\vendor\revolt\event-loop\src\EventLoop\Internal\AbstractDriver.php(497): Fiber->resume()

16 D:\phpstudy_pro\WWW\webman\vendor\revolt\event-loop\src\EventLoop\Internal\AbstractDriver.php(553): Revolt\EventLoop\Internal\AbstractDriver->invokeCallbacks()

17 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal{closure}()

18 D:\phpstudy_pro\WWW\webman\vendor\revolt\event-loop\src\EventLoop\Internal\AbstractDriver.php(113): Fiber->resume()

19 D:\phpstudy_pro\WWW\webman\vendor\workerman\workerman\src\Events\Revolt.php(93): Revolt\EventLoop\Internal\AbstractDriver->run()

20 D:\phpstudy_pro\WWW\webman\vendor\workerman\workerman\src\Worker.php(1594): Workerman\Events\Revolt->run()

21 D:\phpstudy_pro\WWW\webman\vendor\workerman\workerman\src\Worker.php(1519): Workerman\Worker::forkWorkersForWindows()

22 D:\phpstudy_pro\WWW\webman\vendor\workerman\workerman\src\Worker.php(585): Workerman\Worker::forkWorkers()

23 D:\phpstudy_pro\WWW\webman\runtime\windows\start_plugin.thb.redis.table_field_sync.php(33): Workerman\Worker::runAll()

24 {main} []

115 1 0
1个回答

先执行下 \support\Context::init();

×
🔝