代码拉取完成,页面将自动刷新
同步操作将从 xiaobaiskill/easyswoole-admin 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
<?php
/**
* Created by PhpStorm.
* User: yf
* Date: 2018/5/28
* Time: 下午6:33
*/
namespace EasySwoole\EasySwoole;
use EasySwoole\EasySwoole\Swoole\EventRegister;
use EasySwoole\EasySwoole\AbstractInterface\Event;
use EasySwoole\Http\Request;
use EasySwoole\Http\Response;
use EasySwoole\Utility\File;
use EasySwoole\EasySwoole\Config;
use App\Process\HotReload;
use App\Utility\Pool\MysqlPool;
use EasySwoole\Component\Pool\PoolManager;
use App\Utility\Template\Blade;
use EasySwoole\Template\Render;
use EasySwoole\EasySwoole\ServerManager;
use easySwoole\Cache\Cache;
class EasySwooleEvent implements Event
{
public static function initialize()
{
// TODO: Implement initialize() method.
date_default_timezone_set('Asia/Shanghai');
// 加载配置项
self::loadConf();
}
public static function loadConf()
{
$files = File::scanDirectory(EASYSWOOLE_ROOT . '/App/Config');
if (is_array($files)) {
foreach ($files['files'] as $file) {
$fileNameArr = explode('.', $file);
$fileSuffix = end($fileNameArr);
if ($fileSuffix == 'php') {
Config::getInstance()->loadFile($file);
} elseif ($fileSuffix == 'env') {
Config::getInstance()->loadEnv($file);
}
}
}
}
public static function mainServerCreate(EventRegister $register)
{
// 热更新
$hot_reload = (new HotReload('HotReload', ['disableInotify' => false]))->getProcess();
ServerManager::getInstance()->getSwooleServer()->addProcess($hot_reload);
// mysql
PoolManager::getInstance()->register(MysqlPool::class);
// template
$viewDir = EASYSWOOLE_ROOT . '/App/Views';
$cacheDir = EASYSWOOLE_ROOT . '/Temp/Template';
Render::getInstance()->getConfig()->setRender(new Blade($viewDir,$cacheDir));
Render::getInstance()->attachServer(ServerManager::getInstance()->getSwooleServer());
// cache -- file redis memcache
$conf = Config::getInstance()->getConf('app.cache');
Cache::init($conf);
}
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.
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。