<span style= "FONT-FAMILY:KAITI_GB2312;FONT-SIZE:18PX;" >******************* setting up the server ************</span>
1. This interface by default is in English, but Wamp built-in Chinese support, we only need to set up a bit, we right click on the icon of the tray, select the language in the pop-up menu, and then select Chinese, you can, the following is the operation:
2. Below I look, the interface has become Chinese, and then we click on the icon left button, and then find the part of the WWW directory inside, we click on it, enter the WWW directory:
3. Then we create a new file in the WWW directory, our suffix must be modified to PHP, we might as well name xin.php, and then write the following:
<span style= "FONT-FAMILY:KAITI_GB2312;FONT-SIZE:18PX;" ><?phpecho "Sinsing PHP, looking forward to your attention";</span>
4, then we save the file and then we enter it in the browser http://localhost/xin.php And then enter to run and find the effect as follows:
5. At this point, we have completed our first PHP program, or PHP script.
Operating principle *********************
1. I don't know if the reader has any questions about how it works, and if you have questions about it, Sinsing explain it to you.
2. When we use the browser to access the localhost/xin.php, our browser will send this request to our Apache server, Then our Apache server will know that we want to run the inside of the xin.php this program, and then it let our PHP parser to parse our xin.php file.
3. When our PHP parser sends the parsed result to Apache, our Apache then passes the result to our users, so we see this page.
PHP File Interpretation *****************
1. Next we should understand what our PHP files have done, and we analyze the two lines of code.
2. Our php files are usually < The beginning of PHP, which indicates that this is the beginning of a PHP file.
3. Then we can start another line, in other places to write our PHP code, here we have not explained the syntax of the code inside, we first don't worry.
4. Here's echo "Sinsing PHP, look forward to your attention"; We often call it an echo statement, which is to send the contents of the double quotation marks to our browser.
5. It is important to note that the Echo statement is followed by a semicolon, and is a half-width semicolon, that is, the English format of the semicolon entered, do not forget, as for its role, we will mention later.
Extrapolate ****************
1. Let's take a look at the above example and we'll write another example.
2. We are still in the Wamp www directory (remember how to enter it?) If you don't remember, turn it upside down, create a new xin1.php, and write the following:
?? <?phpecho "with the star of the brother learn PHP"; echo "<br/>"; echo "Sinsing series, for you to clear all obstacles on the road to self-study;
3. Then we enter the following in the browser: localhost/xin1.php, and then return to look at the effect, as follows:
4. Let me explain to you that the echo "<br/>" Here is the function of letting the content wrap, and we see this in the inside.
5. It is also important to note that we use three echoes here, that is, we use three echo statements, and each ECHO statement is followed by a semicolon to indicate that this is a statement, The concept of a statement we'll talk about in the next section.
Novice misunderstanding ************************
1. In my summer edition of the reader's letter, I found that the following questions are still many.
2. The 1th is punctuation must use English punctuation, that is, the use of half-width double quotation marks and semicolons.
3. The 2nd is to write the right place, many children's shoes do not have to write the PHP file to the specified location, that is, the browser entered the wrong URL.
Practice *************************** under Class
1. In order to consolidate the knowledge learned in time, I suggest you earnestly complete the following exercises, if the completion of the time encountered difficulties, please leave a message below, I will promptly reply.
2. Exercises: Output Your name on the page, and line, the next line to output your birthday, in line, and then the next line to output your gender.
3.:
4. Reference code:
<?phpecho "Sinsing", echo "<br/>"; echo "0913"; echo "<br/>"; Echo "male";
5. Sinsing, look forward to your attention, if you have any questions, you can leave a message below.
"2014" "Sinsing" "PHP" "Fall" "2" The first PHP program