Ai
1 Star 0 Fork 0

xiusin/swoole-bundle

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
SwooleBundle.php 905 Bytes
一键复制 编辑 原始数据 按行查看 历史
xiusin 提交于 2020-01-16 15:23 +08:00 . 修改Bundle
<?php
namespace xiusin\SwooleBundle;
use xiusin\SwooleBundle\DependencyInjection\WebServer;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class SwooleBundle extends Bundle
{
private $swooleName = 'app.swoole';
public function boot()
{
if ($this->swooleHasStarted()) {
$this->registerServices();
}
}
private function swooleHasStarted()
{
$server = WebServer::getInstance();
if ($server) {
return $server->started();
} else {
return false;
}
}
private function registerServices()
{
$this->container->set($this->swooleName, WebServer::getInstance()->httpServer());
// todo 这里不要强依赖session
// $req = $this->container->get('kernel')->request;
// $this->container->get('session')->setId($req->cookies->get(session_name()));
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/xiusin/swoole-bundle.git
git@gitee.com:xiusin/swoole-bundle.git
xiusin
swoole-bundle
swoole-bundle
master

搜索帮助