如何在开始新会话之前终止当前的 php artisan serve 会话?

How can I kill the current php artisan serve session before starting a new one?

我经常发现自己在 运行 php artisan serve

时打开了很多端口
Laravel development server started: <http://127.0.0.1:8000>
[Thu Dec  2 19:56:23 2021] Failed to listen on 127.0.0.1:8000 (reason: Address already in use)
Laravel development server started: <http://127.0.0.1:8001>
[Thu Dec  2 19:56:23 2021] Failed to listen on 127.0.0.1:8001 (reason: Address already in use)
Laravel development server started: <http://127.0.0.1:8002>
[Thu Dec  2 19:56:23 2021] Failed to listen on 127.0.0.1:8002 (reason: Address already in use)
Laravel development server started: <http://127.0.0.1:8003>

在开始新的之前有没有杀http://127.0.0.1:8000

所以我的申请将在 http://127.0.0.1:8000..

关于如何做到这一点的任何提示?

我想你可以关闭终端,然后端口会自动关闭。

但如果这不起作用,您可以通过 运行 此命令手动终止进程:

kill $(lsof -t -i:8000)