1 Star 0 Fork 0

rainbow / swoole-demo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
EasySwooleEvent.php 1.04 KB
一键复制 编辑 原始数据 按行查看 历史
rainbow 提交于 2019-11-08 17:11 . add official demo
<?php
namespace EasySwoole\EasySwoole;
use EasySwoole\EasySwoole\Swoole\EventRegister;
use EasySwoole\EasySwoole\AbstractInterface\Event;
use EasySwoole\Http\Request;
use EasySwoole\Http\Response;
use EasySwoole\ORM\Db\Connection;
use EasySwoole\ORM\DbManager;
class EasySwooleEvent implements Event
{
public static function initialize()
{
// TODO: Implement initialize() method.
date_default_timezone_set('Asia/Shanghai');
}
public static function mainServerCreate(EventRegister $register)
{
// TODO: Implement mainServerCreate() method.
$config = new \EasySwoole\ORM\Db\Config(Config::getInstance()->getConf('MYSQL'));
DbManager::getInstance()->addConnection(new Connection($config));
}
public static function onRequest(Request $request, Response $response): bool
{
// TODO: Implement onRequest() method.
return true;
}
public static function afterRequest(Request $request, Response $response): void
{
// TODO: Implement afterAction() method.
}
}
PHP
1
https://gitee.com/wujizhou/swoole-demo.git
git@gitee.com:wujizhou/swoole-demo.git
wujizhou
swoole-demo
swoole-demo
master

搜索帮助