current_time-unindent.cgi

来自「嵌入式WEB」· CGI 代码 · 共 38 行

CGI
38
字号
#!/usr/bin/perl -wTuse strict;use CGI;my $timestamp = localtime;display_document( $timestamp );sub unindent;sub display_document {    my $timestamp = shift;        print unindent <<"    END_OF_MESSAGE";      Content-type: text/html            <html>        <head>          <title>The Time</title>        </head>                <body bgcolor="#ffffff">          <h2>Current Time</h2>          <hr>          <p>The current time according to this system is:           <b>$timestamp</b></p>        </body>      </html>    END_OF_MESSAGE}sub unindent {    local $_ = shift;    my( $indent ) = sort /^([ \t]*)\S/gm;    s/^$indent//gm;    return $_;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?