首页 > 代码库 > PHP5.4+自带用于开发的服务器
PHP5.4+自带用于开发的服务器
Using the Built-in PHP CLI Server¶
Alternatively — if you are using PHP 5.4 or above — you can use the built-in CLI server (cli-server). To do this, you just start the server in the root directory:
1 | php -S 0.0.0.0:8080 -t public/ public/index.php |
This will make the website available on port 8080 on all network interfaces, using public/index.php to handle routing. This means the site is accessible via http://localhost:8080 or http://<your-local-IP>:8080.
If you’ve done it right, you should see the same result as with Apache above.
To test that your routing is working, navigate to http://localhost:8080/1234 and you should see the same error page as with Apache above.
PHP5.4+自带用于开发的服务器
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。