一个关于cgi的简单问题,欢迎大家来抢分!(50分)

  • 主题发起人 主题发起人 cwt
  • 开始时间 开始时间
C

cwt

Unregistered / Unconfirmed
GUEST, unregistred user!
我按照例子写了一个基于控制台的cgi程序,如下:
program CgiDate;
{$APPTYPE CONSOLE}
uses
SysUtils;
begin
{ TODO -oUser -cConsole Main : Insert code here }
writeln(' content - type: text / html');
writeln;
writeln(' < html > < head > ');
writeln(' < title > Time at this site < / title > ');
writeln(' < / head > < body > ');
writeln(' < h1 > Time at this site < / h1 > ');
writeln(' < hr > ');
writeln(' < h3 > ');
writeln(FormatDateTime('"Today is " dddd, mmmm d, yyyy, ' +
'" < br > and the time is" hh: mm: ss AM / PM', Now));
writeln(' < / h3 > ');
writeln(' < hr > ');
writeln(' < i > Page generated by CgiDate.exe < / i > ');
writeln(' < / body > < / html > ');
end.

调用方法如下:
http://cwt/Scripts/cgidate.exe
在网页中显示的结果如下:
< html > < head >
< title > Time at this site < / title >
< / head > < body >
< h1 > Time at this site < / h1 >
< hr >
< h3 >
Today is 星期三, 八月 14, 2002, < br > and the time is 08: 35: 44 A8 - P8
< / h3 >
< hr >
< i > Page generated by CgiDate.exe < / i >
< / body > < / html >
请问为什么把控制符号也显示出来了?
 
Response.Writeln
 
请不要画蛇添足在控件符中加那些空格:
program CgiDate;
{$APPTYPE CONSOLE}
uses
SysUtils;
begin
{ TODO -oUser -cConsole Main : Insert code here }
writeln('content-type:text/html');
writeln;
writeln('<html><head>');
writeln('<title> Time at this site </title> ');
writeln('</head><body>');
writeln('<h1>Time at this site </h1> ');
writeln('<hr>');
writeln('<h3>');
writeln(FormatDateTime('"Today is " dddd, mmmm d, yyyy, ' +
'" <br> and the time is" hh: mm: ss AM / PM', Now));
writeln('</h3>');
writeln('<hr>');
writeln('<i>Page generated by CgiDate.exe </i>');
writeln('</body></html>');
end.
 
to ZRWeng:
但是我用的是控制台,找不到Response.Writeln!
 
aizb说的是对的,送分!
 
后退
顶部