scope is a
request type, the framework is not
初始化 when it is
Instead, lazy loading is used after the
onRequest event is triggered.
It will not be initialized when the framework is initialized.
It will only be initialized when it is actually called. The singleton will be kept in the current request and will be automatically destroyed after the request ends. The scope is always in one request
Can only be obtained by getting
$obj = BeanFactory::getRequestBean($name, (string) $tid);
- Name requestBean name / alias / class name
- The tid is usually bound to the
是顶级协程ID. Get the
顶级协程IDcurrent coroutine environment.
If you need to get the current request,
request bean . can use:
$pool = BeanFactory::getContainer()->getRequestPool()
After all coroutines have been executed, the
request bean bound to the
自动销毁 in the
At this point, the life cycle of the
request bean is over.