PHP inWebsite constructionThe server side accepts the user's request, and then returns the required results according to the user's request.To process user requests, PHP needs to know what the user has requested.
WWW provides network services to users based on HTML language and HTTP protocol.When people use the browser to access the website server, the communication between the browser and the server is like people to people chat. HTML is the content of chat, and HTTP protocol is the way of voice transmission.To make a metaphor, suppose that all the people on earth speak HTML language, one day.The Star Wars broke out and Mars was under attack. A Martian came to the Earth to ask for help. He spoke to the Earthman with his mouth open for a long time, but the Earthman did not understand what he was saying. Until the Earthman taught the Martians to speak HTML, the Earth knew that the Martians needed help.It can be seen that to let the PHP on the server side know what the user on the client side has requested, the first thing to learn is how the browser speaks in HTML and what it says.
1、 Basic format of HTML document
Open the Windows Notepad and enter the code 1-1.
Select the File | Save As menu command to display the dialog box, remove the default "*. txt" in the File Name text box, enter the file name "helloworld. htm", select the save location "Desktop", and click the Save button, as shown in Figure 1.2.
The helloworld.htm file is an HTML document. The difference between the content of the file and the ordinary text document is:
The HTML document file name ends with ". html" or ". htm".
The content of an HTML document contains tags "<" and ">", which appear in pairs. For example, in the helloworld.htm document, the first tag is<html>, which tells the browser that this is the beginning of the HTML document. The last tag of an HTML document is</html>, which tells the browser that this is the end of the HTML document. The text between the<head>and</head>tags is header information.Header information is not displayed in the browser.The text between the<title>and</title>tags is the document title, which is displayed in the title bar of the browser window.The text between the<body>and</body>tags is the body and will be displayed in the browser.
2、 Show Hello World with labels
You saved "helloworld.htm" on your desktop in the previous step. If it has been deleted, you can save it again by pressing the method in the first step. Double click the "helloworld.htm" file, or start the browser, and select the File | Open menu command to display the Open dialog box. Click the Browse button to display the browse dialog box. Select "Desktop" as the open location, and select "Open" in the list boxHelloworld.htm "file, click the" Open "button, and the" Open "text box in the open dialog box displays the path of helloworld.htm, as shown in Figure 1.3.
Finally, click OK, and the browser displays Hello World.
Comparing the code and the display results, we can see that all the tags included by the "<" and ">" symbols are not displayed in the browser, the "Page Title" in the<title>and</title>tags is displayed in the browser title bar, and the "Hello World" between<body>and</body>is displayed in the browser content bar.