Perl Web 服务器初级编程[4]

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 nistal 的 blog

#request_method : the http method of request,maybe "get" or "post"
#script_filename: script's file path
#script_name: script's url
#server_name :server's host name
#server_software: web server listening request

               perl 创建http头和html头的过程:
               面向对象:    print $cgi->header  (print $cgi->header('image/jpeg'))    print $cgi->start_html(“my cgipage“);
               面向过程:    print header;(print header('image/jpeg'))    print start_html(“my cgipage“);

               高级头:
                   print $cgi->header(-status=>'200 nistal',
                                                 -type=>'text/html',       
                                                 -expires=>'+30s',
                                                 -nph=>1,
                                               );
                 产生的头如下:
                          http/1.0 200 nistal
                          status:200 nistal
                          expires:mon 25 dec 2005 4:35 gmt
                          date:mon 25 dec 2005 4:15 gmt
                          content-type: text/html; charset=iso-8859-1
                参数列表:
                          -status  响应代码和消息
                          -expires截止时间或日期  
                          -nph     切换到非解析头模式  脚本输出产生时被直接发送给客户机,服务器不干预
                                      为了使输出非缓冲,我们可以设置$|=1来激活autoflush模式;也可以把nph作为导入标记来传递激活nph模式
                                 use cgi qw(:standard'nph');
                        
                高级document头:

本文关键:Perl Web 服务器初级编程
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top