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.
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。