文档介绍:How CGI Scripting Works
by Marshall Brain
The article How Web Pages Work discusses the basic features of HTML and shows you how to
create Web pages that contain text and graphics. It also shows you how to get your page "on the
air" with a hosting service. One of the questions frequently asked by new Web site designers
once they get their site up is, "What is CGI Scripting and how can I use it on my site?" or, "How
do I create interactive forms on my site?"
In this edition of HowStuffWorks, we will answer your questions about CGI scripting and show
you how to create your own scripts. You'll also learn a bit about Web servers in the process. Let's
get started!
Web Servers
As described in the article How Web Servers Work, Web servers can be pretty simple. At their
most basic, Web servers simply retrieve a file off the disk and send it down the wire to the
requesting browser. Let's say you type in the URL
ks/tg2rw/. The server gets a request for the file
/books/tg2rw/. If you look at the following figure, you can see how the server
resolves that request:
During setup, the Web server has been instructed to understand that c:\My Documents\www is
the server's root directory. It then looks for /books/tg2rw/ off of that root. When you
ask for the URL ks/tg2rw/, the server understands that you are
looking for the defa