From 776f7d3ccfeb75b91e125339345ed03ba95edc38 Mon Sep 17 00:00:00 2001 From: augushong <31880431+augushong@users.noreply.github.com> Date: Sun, 24 May 2026 11:50:14 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20run=20=E5=91=BD=E4=BB=A4=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E4=BB=8E=20.env=20=E8=AF=BB=E5=8F=96=20HOST/PORT=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优先级:命令行参数 > .env > 默认值 .env 配置示例: [SERVER] HOST=0.0.0.0 PORT=9000 --- src/think/console/command/RunServer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/think/console/command/RunServer.php b/src/think/console/command/RunServer.php index 92bdd3d49e..b117c15f7f 100644 --- a/src/think/console/command/RunServer.php +++ b/src/think/console/command/RunServer.php @@ -48,8 +48,8 @@ public function configure() public function execute(Input $input, Output $output) { - $host = $input->getOption('host'); - $port = $input->getOption('port'); + $host = $input->getOption('host') ?: env('server.host', '0.0.0.0'); + $port = $input->getOption('port') ?: env('server.port', 8000); $root = $input->getOption('root'); if (empty($root)) { $root = $this->app->getRootPath() . 'public';