离线使用 PHP
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6269467/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Working with PHP offline
提问by Michael
Is there a tool or extension for a browser to working with PHP offline? I read about you need to install an Apache server.
是否有浏览器可以离线使用 PHP 的工具或扩展?我读到您需要安装 Apache 服务器。
Is there an easier way to view offline in browser to see how the PHP code executes?
有没有更简单的方法可以在浏览器中离线查看以查看 PHP 代码的执行方式?
采纳答案by Naftali aka Neal
回答by ceejayoz
回答by salathe
This won't be much use to you now, but there has been recent talk (and submission of code) of providing a built-in web server into PHP itself.
这对您现在没有多大用处,但最近有关于在 PHP 本身中提供内置 Web 服务器的讨论(和提交代码)。
See the RFC at https://wiki.php.net/rfc/builtinwebserver
请参阅https://wiki.php.net/rfc/builtinwebserver 上的 RFC
You could then write your script (e.g. app.php
), execute php -S localhost:8000
to start the web server and then see the results in your browser at http://localhost:8000/app.php
.
然后,您可以编写脚本(例如app.php
),执行php -S localhost:8000
以启动 Web 服务器,然后在浏览器中查看结果http://localhost:8000/app.php
。
In the mean time, you can install Apache/PHP/MySQL/etc. on your local box, as the other answers have suggested, either manually or with a package like XAMPP.
同时,您可以安装Apache/PHP/MySQL/etc。在您的本地盒子上,正如其他答案所建议的那样,手动或使用XAMPP 之类的包。
回答by Ignacio Vazquez-Abrams
回答by b_dubb
if you are on a Mac, you have Apache installed already. the additional instructions you will need to add PHP and MySQL database server can be found here http://www.entropy.ch/software/macosx/
如果您使用的是 Mac,则您已经安装了 Apache。添加 PHP 和 MySQL 数据库服务器所需的其他说明可以在这里找到http://www.entropy.ch/software/macosx/
if you are using Windows, XAMPP is a self contained Apache/MySQL/PHP environment that runs as a stand alone application.
如果您使用的是 Windows,XAMPP 是一个独立的 Apache/MySQL/PHP 环境,可作为独立应用程序运行。
that should get you started. good luck
这应该让你开始。祝你好运