Reprint: http://blog.csdn.net/u012861467/article/details/54692236
Just started to contact PHP development, build the development environment is the first step, download Phpstorm and phpstudy software online, how to install and activate it is not detailed, we focus on how to match these two development environment.
Premise: Now assume that you have installed phpstorm and Phpstudy software.
My phpstorm is using the default installation directory, this is no doubt, Phpstudy software I choose to extract the directory is G:\Program files\.
The WWW folder in the Extract directory of the Phpstudy software is the root directory of our website.
Now we use Phpstorm to create a new project.
First step: Open the Phpstorm software, click Create New Project, fill in the Input box project name, Project storage address, project type information.
Here is my configuration information to see. Fill out the Click OK.
Step Two: Set the version information for the PHP project
The level I chose here is PHP5.6.
Interpreter now the default is not, we have to configure a bit first.
Click the button next to the Interpreter selection box to jump to the interface such as:
Default Not configured left-hand side of the box is blank, I have configured, so now left hand two interpreter version, now we want to create a new interpreter, click the 1 Position button to add interpreter, Fill in the name of the interpreter in 2, position 3 is the location of the Php.exe file we want to set, click "..." on the right-hand side, select our phpstudy php.exe file location in the popup dialog box (Phpstudy help us integrate PHP).
Click OK after the configuration is complete. Now we go back to the previous interface and click on the drop-down to see the interpreter we just configured.
Choose one of these here to see what version you want to use. Click OK again, and the creation of the new project is complete.
Step three: Create a new PHP file
Now our project is no file, we need to create a new Web page file. Select the project file right-click New to see several file formats:
I've created two new files, such as:
The contents of the file are as follows:
Form.html
[HTML]View PlainCopy
- <! DOCTYPE HTML>
- <HTML lang="en">
- <head>
- <meta charset="UTF-8">
- <title>php processing Form 2</title>
- </head>
- <body>
- <form action="welcome.php" method="POST">
- Name: <input type="text" name="fname">
- Age: <input type="text" name="ages">
- <input type="Submit" value= "submission">
- </form>
- </body>
welcome.php
[HTML]View PlainCopy
- <! DOCTYPE HTML>
- <HTML lang="en">
- <head>
- <meta charset="UTF-8">
- <title>$_post Get form post information </title>
- </head>
- <body>
- <? PHP
- echo "Welcome". $_post["FName"]. "! <br/> ";
- echo "Your age is". $_post["Ages". " Years old. ";
- ?>
- </body>
- </html>
Now open the form.html file, mouse click anywhere in the contents of the file, there will be a hover box appears:
This is a choice to open the Form.html file browser, we choose one can see the form.html file display effect, in fact, just a simple form:
The point is, also I write this blog purpose, we fill out the form information after clicking the "Submit" button, we want to achieve the effect is to jump to the welcome.php page, and display the form.html page we fill in the name and age information. The problem is, after jumping the browser displays "File not found". It's depressing, Why form.html files can also be opened, and welcome.php files and form.html files are placed in the same level of directory, Ah, how can not find it, tossing a day, finally found the problem, I only edit the local file, as for the form.html file can be opened because Phpstorm soft The pieces automatically help us to open the file using the local server so we can find it, and the welcome.php file is not submitted to the local server.
The following is the solution (mainly to configure the local server);
Step One: Configure the local server
Selection: Tool-->deployment-->configuration
There is no configuration information for the first time:
We click "+" to add the server configuration, select "Local or Mounted folder" in the pop-up box:
The following configuration is important, whether the file can be found properly, after adding the server we need to configure the location of the file:
Select "Connection", position 3 is the server type we chose just now, the key is location 4 and 5.
"Upload/download project Files" means to upload or download the file directory, here is very important, because we are using Phpstudy,phpstudy has its own site directory, here I set is Phpstudy site root directory, Is our previous Phpstudy decompression position G:\Program files\phpstudy\www, later will know this directory location is what use.
"Browse files on server" means the access address of the server project (that is, the link address of the project page can be opened with a browser), which can be written as the root address "http://localhost/" of Phpstudy, and then the specific file location can be specified later.
Select "Mappings", as configured:
Note here that position 2 is selected and gray is not clickable.
Location 3 is the address of the project source file, and my project file is placed under the "G:\Php-workspace\MyTest" directory.
Location 4 is the detailed folder location of the project on the local server (relative to the "Upload/download project Files" Location we set in "Connection", which is where we will deploy the source code upload to the server's file location), here I designate as "/ Phpstudytest ", when the project will be uploaded to the" G:\Program files\phpstudy\www\phpstudytest "this Phpstudytest folder.
Position 5 is relative to the location of "Browse files on server" that we set in "Connection", our project is now placed under the "localhost" root location phpstudytest folder, so set to "/ Phpstudytest ".
Location 6 is a preview of the link address that we can use to open the item in the browser.
The key is to understand the meaning of these folders, or not access to the Web file.
After configuration click "OK", now we still do not upload the project to the server, the next step is to set the upload project configuration.
Step Two: Configure the Run debugging environment
Click Edit structure:
Expand Default, PHP Web application, which is now <no server> state, such as:
Click the "..." button and click "+" in the pop-up box to add the server information
Location 1 fill in the configuration name, location 2 fill in the address of our local server, here is "localhost", port default is 80,debugger default is good, can also go to configure Xdebug, here is not focus. When you are finished, click: Apply, OK.
Back to the previous page, you can see our configuration name in the server dropdown:
Location 2 is our default link start location, here fill in "/" just fine.
Location 3 is the default browser type that we use for debugging.
Now everything is well-configured. Ok!!!!!!!!!!!!!!
Deploy the project to the server
Click the Project Right button can also, we choose to click on the toolbar, click the location such as:
After uploading successfully, the console output;
If you do not want to manually upload each time, you can set the automatic mode, automatic mode when we modified the file and saved, the software automatically upload the modified file to the server. Settings are as follows:
Now let's look at the effect:
Click Run form.html
Then click Submit, now can jump normally:
Project Source:
http://download.csdn.net/detail/u012861467/9743767
Well, this article is over, hoping to help the students who are still looking for solutions. This is also my conclusion through practice, I hope to respect the work of others, write so long not easy, reprint remember to mark the original link address.
If there is anything bad written in the place welcome to point out, thank you.
Reprint: Super Detailed construction phpstorm+phpstudy development environment