使用PHPstorm在浏览器中执行php代码 [英] Making the php code execute in browser using PHPstorm

查看:635
本文介绍了使用PHPstorm在浏览器中执行php代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以当我点击运行时,PHPstorm在其控制台中正常运行php代码,这很好,但我想在浏览器中看到它。

So PHPstorm is running the php code fine in its console when I click run, that's great but I want to see it in the browser.

所以我创建了一个PHPstorm中的新PHP Web应用程序,将服务器设置为localhost:8000。

So I created a new PHP web application inside PHPstorm, set up the server to "localhost:8000".

现在当我点击RUN它打开浏览器但我收到一条错误消息:糟糕!Google Chrome无法连接到localhost:8000

Now when I click RUN it opens the browser but I get an error message: "Oops! Google Chrome could not connect to localhost:8000"

我做错了什么?

谢谢!

推荐答案

您必须先为项目配置运行配置。

You have to configure a run configuration for your project first.

转到运行 - >编辑配置,单击PHP内置Web服务器,然后按+。你应该看到这样的东西:

Go to Run -> Edit Configurations, click on "PHP Built-in Web Server" and then press "+". You should see something like this:

保存设置后,您可以通过运行 - >运行Web服务器运行'< project-name>'。它现在应该将页面提供给您的浏览器。

After saving the settings you can run the web server via Run -> Run '<project-name>'. It should now serve up the pages to your browser.

这篇关于使用PHPstorm在浏览器中执行php代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆