C & C++ 語言C# 語言Visual Basic 語言PHP 語言JAVA 語言CGI 語言

如果註冊後24小時內沒有收到E-mail驗証信,請Email給管理員手動開通。管理員E-Mail: admin@eyny.com

The Basics of CGI Developer's Guide - 3. Outputting CGI

[顯示][隱藏]
Outputting CGI

You can now take a closer look at how to send information to the Web browser. As you saw in the "Hello, world!" example, Web browsers expect two sets of data (see Figure 2.3): a header that contains information such as the type of information to display (such as the Content-Type: line) and the actual information (what shows up on the Web browser). These two blocks of information are separated by a blank line.

The header is called an HTTP header. It provides important information about the information the browser is about to receive. There are several different types of HTTP headers, and the most common is the one you used previously: the Content-Type: header. You can use different combinations of HTTP headers by separating them with a carriage return and a newline (\r\n). The blank line separating the header from the data also consists of a carriage return and a newline (why you need both is described briefly in the preceding note and in detail in Chapter 4). You learn the other HTTP headers in Chapter 4; for now, you focus on the Content-Type: header.

The Content-Type: header describes the type of data the CGI is returning. The proper format for this header is

Content-Type: subtype/type

where subtype/type is a valid multipurpose Internet mail extensions (MIME) type. The most common MIME type is the HTML type: text/html. Table 2.1 lists a few of the more common MIME types you will see; a more complete list and discussion of MIME types is in Chapter 4.

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

NOTE

瀏覽完整內容請先註冊登入會員
The Basics of CGI Developer's Guide - 3. Outputting CGI[url=http://www.eyny.com/viewthread.php?tid=1103869]The Basics of CGI Developer's Guide - 3. Outputting CGI[/url]伊莉討論區[url=http://www.eyny.com/]伊莉討論區[/url]