Revert "改名"
This reverts commit fdf58326
This commit is contained in:
+19
-2
@@ -287,9 +287,12 @@ class ServerManager extends Component
|
||||
$this->server = new $match($host, $port, SWOOLE_PROCESS, $mode);
|
||||
$this->server->set(array_merge(Config::get('server.settings', []), $settings['settings']));
|
||||
|
||||
$string = "| 名称 \t| 值 \t|\n";
|
||||
|
||||
$maxLength = $this->getMaxKeyLength($this->server->setting);
|
||||
|
||||
$string = sprintf("| %s \t| %s \t|\n", str_pad('名称', $maxLength - strlen('名称')), '值');
|
||||
foreach ($this->server->setting as $key => $value) {
|
||||
$string .= sprintf("|%s \t| %s \t|\n", $key, $value);
|
||||
$string .= sprintf("| %s \t| %s \t|\n", str_pad($key, $maxLength - strlen($key)), $value);
|
||||
}
|
||||
echo $string;
|
||||
|
||||
@@ -301,6 +304,20 @@ class ServerManager extends Component
|
||||
}
|
||||
|
||||
|
||||
private function getMaxKeyLength($array)
|
||||
{
|
||||
$length = 0;
|
||||
|
||||
foreach ($array as $key => $val) {
|
||||
if (strlen($key) > $length) {
|
||||
$length = strlen($key);
|
||||
}
|
||||
}
|
||||
|
||||
return $length;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array $settings
|
||||
* @throws ContainerExceptionInterface
|
||||
|
||||
Reference in New Issue
Block a user