Вы находитесь на странице: 1из 2

The World Wide Web consists of a large group of computers, known as servers that exist solely

to provide information when that information is requested. The information is requested by a


piece of computer software called a web browser.
It is said that the web operates on a client-server model, where the client is the web browser and
the server is the computer providing, or serving, the information. That information is typically
stored in a web page, which is nothing more than a specially formatted document that usually
contains images and frequently references to other resources that help the page look and behave
in a certain way.
When a client requests a web page, a web browser such as Microsoft Internet Explorer or
Mozilla Firefox (or Safari or Google Chrome or Opera or Lynx) is used. The web page itself can
be a document stored on your computer, just like a word processing document. A program like
Microsoft Word knows how to open documents formatted for Microsoft Word. In the same way,
a web browser knows how to open documents formatted for the web.
Web browsers are programmed to read and parse the specially formatted documents known as
web pages.
When a web browser requests a page, it typically contacts a web server. Just as the web browser
is software thats programmed to know how to read and parse web pages, the web server is
software thats programmed to send web pages when theyre requested.
Several popular web server software packages are available, but two stand out above the rest:
Apache httpd and Microsoft Internet Information Services (IIS). Between the two of them, these
server software packages are responsible for hosting the vast majority of all web domains.
Web servers and web browsers talk to each other using a protocol called HyperText Transfer
Protocol, or HTTP. In essence, HTTP is just a way for these two parties to speak to each other.
PHP, short for PHP HyperText Preprocessor, is a popular and powerful language used for
programming server-side programs. When PHP builds web pages it frequently needs to retrieve
data to display on the resulting page. This is where MySQL comes in. MySQL is a popular and
free database system that can store information and then integrate with PHP to create a fully
functional web application.
PHP is a scripting language designed specifically for use on the web. It has features to aid you in
programming the tasks needed to develop dynamic web applications.
When PHP language statements are processed, only the output, or anything printed to the screen,
is sent by the web server to the web browser. The PHP language statements, those that dont
produce any output to the screen, arent included in the output sent to the browser, so the PHP
code is not normally seen by the user. For instance, in this simple PHP statement, <?php is the
PHP opening tag, and ?> is the closing tag.
<?php echo <p>Hello World</p>; ?>

The PHP language statements are enclosed in PHP tags with the following form:
<?php ?>
Sometimes you can use a shorter version of the PHP tags. You can try using <? and ? > without
the php. If short tags are enabled, you can save a little typing. However, if you use short tags,
your scripts wont run if theyre moved to another web host where PHP short tags are not
activated.
<!doctype html>
<html>
<head><title>Hello World Script</title></head>
<body>
<p>Hello World!</p>
</body>
</html>
If you open this HTML script in your browser, you see a web page that displays
Hello World!
<!doctype html>
<html>
<head><title>Hello World Script</title></head>
<body>
<?php
echo <p>Hello World!</p>\n;
?>
</body>
</html>
When you run this script, by looking at it in your browser, it displays the same web page as the
HTML script in Listing 1-1. But now youre doing it with PHP!

Вам также может понравиться