有人可以解释这个命令 "php -S localhost:8000 -t public" 吗?
can somebody explain this command "php -S localhost:8000 -t public"?
/**
* Get the full server command.
*
* @return string
*/
protected function serverCommand()
{
return sprintf('%s -S %s:%s %s/server.php',
ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)),
$this->host(),
$this->port(),
ProcessUtils::escapeArgument($this->laravel->basePath())
);
}
也没有收到
它正在创建用于启动 built-in 和 PHP 附带的服务器的命令。服务器在端口 8000
运行,服务器文件来自 ./public
目录。
https://www.php.net/manual/en/features.commandline.webserver.php
-S
参数从 php 可执行文件启动嵌入式 Web 服务器。
它很小,不适合生产或public使用合适的网络服务器,主要用于调试或演示。
localhost:8000
部分当然是服务器将使用的地址。
-t
参数允许您为 webroot 指定一个目录。在这种情况下,public
目录将用作网络服务器的根目录。
总而言之,它是一个非常有用的调试和测试工具,因为您不必设置整个 Apache 或 nginx 服务器。
但如上所述:它不适合生产或 public 使用,因为它不是像 Apache 这样功能齐全的网络服务器!
/**
* Get the full server command.
*
* @return string
*/
protected function serverCommand()
{
return sprintf('%s -S %s:%s %s/server.php',
ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false)),
$this->host(),
$this->port(),
ProcessUtils::escapeArgument($this->laravel->basePath())
);
}
也没有收到
它正在创建用于启动 built-in 和 PHP 附带的服务器的命令。服务器在端口 8000
运行,服务器文件来自 ./public
目录。
https://www.php.net/manual/en/features.commandline.webserver.php
-S
参数从 php 可执行文件启动嵌入式 Web 服务器。
它很小,不适合生产或public使用合适的网络服务器,主要用于调试或演示。
localhost:8000
部分当然是服务器将使用的地址。
-t
参数允许您为 webroot 指定一个目录。在这种情况下,public
目录将用作网络服务器的根目录。
总而言之,它是一个非常有用的调试和测试工具,因为您不必设置整个 Apache 或 nginx 服务器。
但如上所述:它不适合生产或 public 使用,因为它不是像 Apache 这样功能齐全的网络服务器!