Introduction: This is a detailed page of PHP and MySQL (1). It introduces PHP, related knowledge, skills, experience, and some PHP source code.
Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 343822 'rolling = 'no'>
In this chapter, we will introduce the script language of the PHP server. We will see that this language supports communication with the MySQL database.
PHP Introduction
As we mentioned earlier, PHP is a server-side scripting language. This concept may be hard to understand, especially if you
Previously, when only HTML and JavaScript were used to design webpages
Yes. A server scriptProgramSimilar to Javascript in many places, both allow you to insert some programs (scripts) in the HTML of the web page ). The result is that
Some scripts allow you to control what will be displayed in the browser window, which is obviously much more flexible than using HTML directly.
The key difference between JavaScript and PHP is that when a web browser interprets JavaScript,
The web page containing the script has been downloaded.
For the server-side scripting program, the explanation is completed by the server before the page is sent to the browser. After the explanation is completedCodeWill be replaced by the results of script running,
The viewer can see standard HTML files. Scripts are completely processed by the server. This is the origin of its naming: server-side scripting.
Let's look back at the example today. php we created in Chapter 1:
<HTML> <Head> <Title> today's date </title> </Head> <Body> <P> today's date (according to this Web Server) is <? PHP Echo (date ("L, f ds y .")); ?> </Body> </Html> |
Most of this program uses HTML format. Only when <? PHP and
?> The middle line is written in PHP. <? PHP indicates "Starting PHP code",?>
End PHP code ". Before sending the web page to the browser requesting it, the Web server processes all the content before the two identifiers and converts it to a standard
HTML code. The page received by the browser will be as follows:
<HTML> <Head> <Title> today's date </title> </Head> <Body> <P> today's date (according to this Web Server) is Wednesday, June 7th 2000. </Body> </Html> |
Note that all PHP code is not displayed. They are replaced by the corresponding standard HTML. Through this example, we can see several advantages of server-side scripts:
There is no browser compatibility problem. PHP scripts are only explained by Web servers, so we don't have to worry about whether your language can be supported by your visitor's browser.
You can access resources on the server. In the preceding example, we place the date of the Web server on the web page. When
We use JavaScript. To implement the same function, we
Only the date of the computer on which the web browser runs can be displayed. This example is not very typical for the use of server-side resources. In fact, we can easily insert some other information.
Information can only be called by running scripts on the server. For example, information stored in the MySQL database running on the Web server.
Simplifies client loading. Javascript significantly reduces the display speed of web pages, because before displaying this web page, the browser must first run JavaScript scripts. For server scripts, the web server alone bears this burden.
Love J2EE follow Java Michael Jackson video station JSON online tools
Http://biancheng.dnbcw.info/php/343822.html pageno: 5.