[2014] [Xin Xing] [php] [Autumn] [2] The first php program, 2014 Xin Xing
<Span style = "font-family: KaiTi_GB2312; font-size: 18px; "> ******************* set the server ************** </span>
1. this interface is in English by default, but wamp has built-in Chinese support. You only need to set it. Right-click the tray icon and select Language from the pop-up menu, then select "Chinese". The operation is as follows:
2. Let me take a look at the following: the interface has already become Chinese. Then, we click the icon and find the part of the www directory. Then, we click it to go to the www directory:
3. Create a new file in the www directory, and change the suffix to php. We may name it "xin. php" and write the following content:
<Span style = "font-family: KaiTi_GB2312; font-size: 18px;"> <? Phpecho "Xin Xing PHP, looking forward to your attention"; </span>
4. Then, save the file, input http: // localhost/xin. php In the browser, and press enter to run the file. The result is as follows:
5. Now, we have completed our first php program, or php script.
*********************
1. I don't know if the reader has any questions about its operating principles. If you have any questions, Xin Xing will explain it to you.
2. when we use a browser to access localhost/xin. in php, our browser will send this request to our Apache server, and then our Apache server will know that we want to run the xin. php, and then let our PHP parser 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 can see this page.
*****************
1. Next we should know what our PHP files are doing, and we will analyze the two lines of code.
2. Our PHP file is usually <? PHP indicates the beginning of a PHP file.
3. Then we can start another line and write our PHP code elsewhere. Here we have not explained the syntax of the Code. Don't worry.
4. Here echo "Xin Xing PHP, looking forward to your attention"; we usually call it an echo statement. Its function is to send the content in the double quotation marks to our browser.
5. note that the echo statement is followed by a semicolon, which is a half-width semicolon, that is, the semicolon entered in the English format, we will mention it later.
****************
1. Next we will compare the above example. Let's write another example.
2. We are still in the www directory of wamp (Do you remember how to enter it? If you do not remember, you can flip it up), create a new xin1.php file, and write the following content:
<? Phpecho "PHP"; echo "<br/>"; echo "Xin Xing series, clear all the obstacles on your way to self-learning ";
3. Enter the following content in the browser: localhost/xin1.php, and press enter to check the effect, as shown below:
4. Let me explain. Here echo "<br/>" is used to wrap the content. We also see this in it.
5. note that three echo statements are used here, that is, three echo statements. Each echo statement must be followed by a semicolon to indicate that this is a statement, the concept of a statement is described in the next section.
********************** **
1. I found a lot of problems in the emails from the readers I received in the summer edition.
2. The first point is to use English Punctuation Marks, that is, double quotation marks and semicolons.
3. The second point is to write to the correct location. Many shoes either do not write the PHP file to the specified location, or enter the wrong url in the browser.
********************** *****
1. In order to consolidate the learned knowledge in time, I suggest you complete the following exercises carefully. If you encounter any difficulties, please leave a message below and I will reply in time.
2. Exercise questions: output your name on the page, line feed, output your birthday in the next line, line feed, and output your gender in the next line.
3 .:
4. Reference code:
<? Phpecho "Xin Xing"; echo "<br/>"; echo "0913"; echo "<br/>"; echo "male ";
5. Xin Xing is looking forward to your attention. If you have any questions, please leave a message below.