Developing PHP applications using NetBeans and Eclipse (1) _php tutorial

Source: Internet
Author: User
Tags ftp connection php and mysql php introduction php source code netbeans
"Php100 exclusive feature" If you look at the market share of NetBeans and Eclipse alone, you might think that using any of these Ides to develop PHP applications is no problem, for example:

1. NetBeans: An open source integrated development environment that allows you to create desktop, enterprise, Web, and mobile device applications that support Java, C/C + +, and even dynamic scripting languages Php,javascript,groovy and Ruby. NetBeans IDE is simple to install, with out-of-the-box features that can be run on multiple operating systems, such as Windows,linux,mac OS X and Solaris.

2. Eclipse: It is an open source project built on Equinox OSGi, and Eclipse is evolving from the Java IDE to support a growing number of languages, including static and dynamic languages, thick clients, thin clients and server-side frameworks, modeling and business reporting, embedded and mobile development. It is currently the best Java IDE.

This article will use NetBeans and eclipse to develop a simple Web application, a search component developed for a virtual bookstore, where the user simply enters the title, author, or ISBN, and the program can find the eligible results from the database. By reading this article, you'll learn about the PHP features of NetBeans and Eclipse, you can compare them, and if both meet your development needs, you can compare them to see which IDE is best for you. To implement the application mentioned above, a series of techniques are needed, including Html,javascript (Ajax), PHP and MySQL 5.0 databases.

The tools that need to be used

NetBeans 6.5 for PHP

Eclipse PDT or Eclipse PDT 2.0

Java Development Kit (JDK) version 5 or 6

MySQL 5.0

PHP5

Apache HTTP Server 2.0

NetBeans IDE 6.5 for PHP Introduction

Starting with NetBeans, I'll start by downloading netbeans,1 from http://www.netbeans.org/downloads/index.html. Installation is only guided by the installation wizard.

498) this.width=498; ' OnMouseWheel = ' javascript:return big (This) ' src= ' http://www.bkjia.com/uploadfile/2013/0904/ 20130904094607231.jpg "width=480>

Figure-1 Download NetBeans IDE 6.5 for PHP: Click on the PHP line in the NetBeans download page

As long as the Java Runtime Environment (JRE) is installed, you can run NetBeans for PHP without installing the full Jdk,netbeans IDE for PHP, the latest version is 6.5, which contains the following new features:

1. PHP Source Code Editor

2. Remote and local project development

3. Simplified Code navigation operation

4, PHP Debugging (you can check local variables, set monitoring points, breakpoints, evaluate the flexibility of the code), NetBeans IDE for PHP also allows you to use XDebug, you can choose a debugger version, but recommended to use XDebug 2.0, it and PHP 5.0 has better compatibility.

5. mysql Integration

Create a PHP project

In order to implement a PHP script/web application, you need to create a PHP project root (an empty project that includes only common files and directories). Regardless of the application, the IDE generally uses the concept of "project," and NetBeans provides a dedicated wizard for configuring a new project, creating a booksphp sample application by following these steps:

1, start NetBeans;

2. Select file à create a new project (Opens a New Project dialog box);

3. Select PHP from the Categories panel, select the PHP application from the project panel (you can also choose to load a PHP application), and click Next.

4, enter the project name and location in this dialog box, enter booksphp here, select a convenient location in the Source Folder field, click Next.

5. NetBeans supports running a PHP application on a local server (usually Apache HTTP server), on a remote server (via FTP) or as a PHP script (using PHP interpreter), in order to compare, you should be in Apache HTTP Server runs the booksphp application, so selecting the local Web site from the list, and then entering the application's Url,url in the Project URL field area is usually similar to http://localhost/... String, this example should be http://localhost/php/booksPHP/(of course you need to tweak the URL for your configuration) because you plan to run the project on the local server, You need to provide a running location for NetBeans to copy the application code to there, select "Copy from source folder to another location" and specify the target location in the "Copy to" area (e.g. C:Program Filesapache groupapache2htdocsphpbooksphp), it is clear that this is only necessary if the root folder of the project is different from the root folder of the local server;

6. Click the Finish button to close the New Project dialog box.

If you choose to run the PHP application as a script, you must specify the location of the PHP interpreter (PHP.exe), and similarly, if you choose to run the PHP application on a remote server, you must specify a valid FTP connection, upload the directory, and upload the method.

At this point, NetBeans builds the project, as shown in 2.

498) this.width=498; ' OnMouseWheel = ' javascript:return big (This) ' src= ' http://www.bkjia.com/uploadfile/2013/0904/ 20130904094607681.jpg "width=480>

Figure 2 Build Project: After completing the New Project Wizard, you will see the resulting project root in the NetBeans IDE.

Implementing the Project

Once the project is created, you can begin to implement booksphp functionality, require some HTML code in the presentation layer, some JavaScript code to implement Ajax, some PHP and database code to implement business logic and persistent tasks, because the application requires all the technology to exist together, You need to take a good look at how NetBeans handles every technology (with the emphasis on PHP support).

Creating an HTML interface
Most of the HTML code for this project resides on the index.php page, index.php created automatically when NetBeans created the project root, and you can use NetBeans's Palette tool to add HTML elements to it, and if you don't see this tool, By clicking on the Window Àpalette menu, Palette provides shortcuts to all the main HTML elements by dragging and completing the selection of elements.

Before adding some tags, NetBeans asks you to specify special configurations for them, such as: when you drag a

Listing 1 HTML code (index.php)


http://www.bkjia.com/PHPjc/446625.html www.bkjia.com true http://www.bkjia.com/PHPjc/446625.html techarticle "php100 exclusive feature" If you look at the market share of NetBeans and Eclipse alone, you might think that using any of these Ides to develop PHP applications is no problem, such as: ...

  • tag, you have to specify the number of rows and columns, and so on, I'm not going to go into the details here, creating HTML code in NetBeans is as easy as walking in a park. Therefore, using the palette and drag elements to modify the index.php, the final result is shown in Listing 1.

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.