PHP –使用Eclipse创建Hello World项目

[rps-include post=6522]

[rps-include post = 6522]

While developing Php applications using IDE will provide a lot of useful feature.

在使用IDE开发Php应用程序时,将提供许多有用的功能。

创建Hello World项目 (Create Hello World Project)

We have installed required software properly in previous steps. As a first step we will run Eclipse . We can start eclipse in different ways. In this situation we prefer starting it from Program menu like below.

在前面的步骤中,我们已经正确安装了必需的软件。 第一步,我们将运行Eclipse 。 我们可以用不同的方式开始Eclipse。 在这种情况下,我们更喜欢从下面的“程序”菜单中启动它。

Another ways to start eclipse is running eclipse command in the terminal like below.

启动eclipse的另一种方法是在终端中运行eclipse命令,如下所示。

$ eclipse

We will see Eclipse Launcher where we will set projects home directory.

我们将看到Eclipse Launcher ,将在其中设置项目的主目录。

We click OK and resume

我们单击OK然后继续

创建PHP项目(Create Php Project)

We will create a Php project in eclipse IDE with the following screen. We will click File -> New -> Project

我们将使用以下屏幕在eclipse IDE中创建一个Php项目。 我们将单击File -> New -> Project

Create Php Project
Create Php Project
创建PHP项目

Then we will see following screen where we select PHP Project

然后,我们将看到以下屏幕,我们在其中选择了PHP Project

Then we will set name of the project and click Finish . We can also select Next where we will specify detailed options of the Php project. In this form we can see that project path where it will be stored.

然后,我们将设置项目的名称,然后单击Finish 。 我们还可以选择Next ,在这里我们将指定Php项目的详细选项。 在此表单中,我们可以看到将要存储该项目的路径。

Simply click Yes to setup screen properly for Php project

只需单击“ Yes即可为Php项目正确设置屏幕

添加新PHP文件(Add New Php File)

We have created our project named Hello World . We need to add some file to the project. We right click on our project on the project pane and select New -> PHP File

我们创建了名为Hello World的项目。 我们需要向项目添加一些文件。 我们在项目窗格上右键单击我们的项目,然后选择New > PHP File

Add New Php File
Add New Php File
添加新PHP文件

We will set the file name as index.php which is default most of the Php projects.

我们将文件名设置为index.php ,这是大多数Php项目的默认设置。

Add New Php File
Add New Php File
添加新PHP文件

配置PHP解释器和可执行文件(Configure Php Interpreter and Executable)

We need to configure the Php interpreter to run applications in Eclipse. We will click the Eclipse main menu Window -> Preferences and get following screen. From Here we will select Php Executable and click Add

我们需要配置Php解释器以在Eclipse中运行应用程序。 我们将单击Eclipse主菜单Window -> Preferences ,然后显示以下屏幕。 从这里我们将选择Php Executable ,然后单击Add

Configure Php Interpreter and Executable
Configure Php Interpreter and Executable
配置PHP解释器和可执行文件

We will set new interpreter’s name as php and path as /bin/php which is default in Linux. Executable path can be found where Php is installed in other operating systems too.

我们将新解释器的名称设置为php ,将路径设置为/bin/php ,这在Linux中是默认设置。 在其他操作系统中安装Php的位置也可以找到可执行路径。

LEARN MORE  Hello World Python
了解更多信息Hello World Python
Configure Php Interpreter and Executable
Configure Php Interpreter and Executable
配置PHP解释器和可执行文件

运行PHP项目(Run Php Project)

Now everything is ok we can run our Hello World applications after putting following code to the index.php and click Run from menu.

现在一切正常,在将以下代码放入index.php并单击Run从菜单Run之后,我们可以运行Hello World应用程序。

Run Php Project
Run Php Project
运行PHP项目

This will print Hello World in the console of Eclipse.

这将在Eclipse的控制台中打印Hello World

Run Php Project
Run Php Project
运行PHP项目

[rps-include post=6522]

[rps-include post = 6522]

翻译自: https://www.poftut.com/php-create-hello-world-project-eclipse/

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值