Download Document 7760007

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Transcript
Getting Started with PHP
Let's look back at the today.php example presented 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.") );
?></p>
</body>
</html>
Most of this is plain HTML. The line between <?php and ?>, however, is written
in PHP. <?php means "begin PHP code", and ?> means "end PHP code". The
Web server is asked to interpret everything between these two delimiters, and
to convert it to regular HTML code before it sends the Web page to the requesting
browser. The browser is presented with something like this:
<html>
<head>
<title>Today's Date</title>
</head>
<body>
<p>Today's Date (according to this Web server) is
Wednesday, May 30th 2001.</p>
</body>
</html>
Notice that all signs of the PHP code have disappeared. In its place, the output
of the script has appeared, and looks just like standard HTML. This example
demonstrates several advantages of server-side scripting:
❑ No browser compatibility issues. PHP scripts are interpreted by the Web
server and nothing else, so you don't have to worry about whether the language
you're using will be supported by your visitors' browsers.
❑ Access to server-side resources. In the above example, we placed the date
according to the Web server into the Web page. If we had inserted the date
using JavaScript, we would only be able to display the date according to the
computer on which the Web browser was running. Now, while this isn't an
especially impressive example of the exploitation of server-side resources, we
50
Document related concepts

Object-relational impedance mismatch wikipedia, lookup

Microsoft SQL Server wikipedia, lookup

Clusterpoint wikipedia, lookup

Open Database Connectivity wikipedia, lookup

Relational model wikipedia, lookup

Database model wikipedia, lookup