且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在我的电脑上运行php文件

更新时间:2023-02-22 20:06:52

您必须运行 Web 服务器(例如 Apache)并浏览到您的本地主机,很可能在端口 80.

You have to run a web server (e.g. Apache) and browse to your localhost, mostly likely on port 80.

您真正应该做的是安装一个像 XAMPP这样的多合一软件包>,它捆绑了 Apache、MySQL PHP 和 Perl(如果您愿意的话)以及一些其他可与 Apache 和 MySQL 一起使用的工具 - 而且它是跨平台的(这就是XAMPP"中的X"所代表的意思).

What you really ought to do is install an all-in-one package like XAMPP, it bundles Apache, MySQL PHP, and Perl (if you were so inclined) as well as a few other tools that work with Apache and MySQL - plus it's cross platform (that's what the 'X' in 'XAMPP' stands for).

一旦你安装了 XAMPP(并且有一个安装程序,所以应该不难)打开 XAMPP 的控制面板,然后单击 Apache 旁边的开始"按钮 - 请注意,在需要数据库的应用程序上,您还需要启动 MySQL(并且您将能够通过 phpMyAdmin 与它进行交互).启动 Apache 后,您可以浏览到 http://localhost.

Once you install XAMPP (and there is an installer, so it shouldn't be hard) open up the control panel for XAMPP and then click the "Start" button next to Apache - note that on applications that require a database, you'll also need to start MySQL (and you'll be able to interface with it through phpMyAdmin). Once you've started Apache, you can browse to http://localhost.

同样,无论您是否选择 XAMPP(我会推荐它),您都应该只需要启动 Apache.

Again, regardless of whether or not you choose XAMPP (which I would recommend), you should just have to start Apache.