public function __construct($configFile = 'server.yaml')
{
$this->checkSystem();
self::$instance = $this;
if ($configFile) {
if (is_array($configFile)) {
self::$config = $configFile;
} else {
if (!function_exists('\\yaml_parse_file')) {
self::warn('必须安装 yaml 插件');
exit;
}
if (is_file($configFile)) {
self::$configFile = realpath($configFile);
# 读取配置
self::$config = yaml_parse_file($configFile);
} else {
self::warn("指定的配置文件: {$configFile} 不存在");
exit;
}
}
}
if (!self::$config) {
self::warn("配置解析失败");
exit;
}
# 主进程的PID
self::$pid = getmypid();
}