Board logo

标题: 比较两种CGI编程风格 [打印本页]

作者: cnangel    时间: 2003-8-6 17:15     标题: 比较两种CGI编程风格

  1. #!/usr/bin/perl
  2. use CGI;
  3. #$name= adasas;
  4. $addr= remote_host;
  5. $q= new CGI;
  6. print$q->header(-type=>'text/html',
  7. -charset=>'gb_2132'
  8. );
  9. print$q->start_html(-title=>'test',
  10. -bgcolor=>'#FFffFF',
  11. -author=>'cnangel',
  12. -text=>'#000000');
  13. $q->p('This is what I mean by '),
  14. $q->b('abstracted'),
  15. print$q->end_html();
  16. exit;
复制代码
  1. #!/usr/bin/perl
  2. print "content-type:text/html \n\n";
  3. if(1 eq 1){&eee;exit;}else{print "error";exit;}
  4. sub eee{
  5. print<<EOF
  6. <html>
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  9. <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
  10. <meta name="ProgId" content="FrontPage.Editor.Document">
  11. <title>leoboard</title>
  12. <meta http-equiv="refresh" content="1; url=http://www.leoboard.com/cgi-bin/leoboard.cgi">
  13. </head>
  14. <body>
  15. </body>
  16. </html>
  17. EOF
  18. }
复制代码





欢迎光临 星星博客 (http://commerce.huhoo.net/) Powered by Discuz! 7.0.0