MyQEE\Server\Server::init PHP 메소드

init() 보호된 메소드

protected init ( )
    protected function init()
    {
        # 设置参数
        if (isset(self::$config['php']['error_reporting'])) {
            error_reporting(self::$config['php']['error_reporting']);
        }
        if (isset(self::$config['php']['timezone'])) {
            date_default_timezone_set(self::$config['php']['timezone']);
        }
        if (isset($config['server']['unixsock_buffer_size']) && $config['server']['unixsock_buffer_size'] > 1000) {
            # 修改进程间通信的UnixSocket缓存区尺寸
            ini_set('swoole.unixsock_buffer_size', $config['server']['unixsock_buffer_size']);
        }
        if (self::$config['clusters']['mode'] !== 'none') {
            if (!function_exists('\\msgpack_pack')) {
                self::warn('开启集群模式必须安装 msgpack 插件');
                exit;
            }
        }
        if (!self::$config['server']['socket_block']) {
            # 设置不阻塞
            swoole_async_set(['socket_dontwait' => 1]);
        }
        $this->info("======= Swoole Config ========\n" . json_encode(self::$config['swoole'], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
        if (self::$clustersType > 0) {
            # 集群模式下初始化 Host 设置
            Clusters\Host::init(self::$config['clusters']['register']['is_register']);
        }
    }