⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cgi.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
📖 第 1 页 / 共 5 页
字号:
\&                             ]\&                     );.Ve.PPAnd here's how to create an HTTP-EQUIV <meta> tag:.PP.Vb 2\&      print start_html(\-head=>meta({\-http_equiv => \*(AqContent\-Type\*(Aq,\&                                    \-content    => \*(Aqtext/html\*(Aq})).Ve.PP\&\s-1JAVASCRIPTING:\s0 The \fB\-script\fR, \fB\-noScript\fR, \fB\-onLoad\fR,\&\fB\-onMouseOver\fR, \fB\-onMouseOut\fR and \fB\-onUnload\fR parameters are usedto add Netscape JavaScript calls to your pages.  \fB\-script\fR shouldpoint to a block of text containing JavaScript function definitions.This block will be placed within a <script> block inside the \s-1HTML\s0 (not\&\s-1HTTP\s0) header.  The block is placed in the header in order to give yourpage a fighting chance of having all its JavaScript functions in placeeven if the user presses the stop button before the page has loadedcompletely.  \s-1CGI\s0.pm attempts to format the script in such a way thatJavaScript-naive browsers will not choke on the code: unfortunatelythere are some browsers, such as Chimera for Unix, that get confusedby it nevertheless..PPThe \fB\-onLoad\fR and \fB\-onUnload\fR parameters point to fragments of JavaScriptcode to execute when the page is respectively opened and closed by thebrowser.  Usually these parameters are calls to functions defined in the\&\fB\-script\fR field:.PP.Vb 10\&      $query = new CGI;\&      print header;\&      $JSCRIPT=<<END;\&      // Ask a silly question\&      function riddle_me_this() {\&         var r = prompt("What walks on four legs in the morning, " +\&                       "two legs in the afternoon, " +\&                       "and three legs in the evening?");\&         response(r);\&      }\&      // Get a silly answer\&      function response(answer) {\&         if (answer == "man")\&            alert("Right you are!");\&         else\&            alert("Wrong!  Guess again.");\&      }\&      END\&      print start_html(\-title=>\*(AqThe Riddle of the Sphinx\*(Aq,\&                               \-script=>$JSCRIPT);.Ve.PPUse the \fB\-noScript\fR parameter to pass some \s-1HTML\s0 text that will be displayed on browsers that do not have JavaScript (or browsers where JavaScript is turnedoff)..PPThe <script> tag, has several attributes including \*(L"type\*(R" and src.The latter is particularly interesting, as it allows you to keep theJavaScript code in a file or \s-1CGI\s0 script rather than cluttering up eachpage with the source.  To use these attributes pass a \s-1HASH\s0 referencein the \fB\-script\fR parameter containing one or more of \-type, \-src, or\&\-code:.PP.Vb 4\&    print $q\->start_html(\-title=>\*(AqThe Riddle of the Sphinx\*(Aq,\&                         \-script=>{\-type=>\*(AqJAVASCRIPT\*(Aq,\&                                   \-src=>\*(Aq/javascript/sphinx.js\*(Aq}\&                         );\&\&    print $q\->(\-title=>\*(AqThe Riddle of the Sphinx\*(Aq,\&               \-script=>{\-type=>\*(AqPERLSCRIPT\*(Aq,\&                         \-code=>\*(Aqprint "hello world!\en;"\*(Aq}\&               );.Ve.PPA final feature allows you to incorporate multiple <script> sections into theheader.  Just pass the list of script sections as an array reference.this allows you to specify different source files for different dialectsof JavaScript.  Example:.PP.Vb 10\&     print $q\->start_html(\-title=>\*(AqThe Riddle of the Sphinx\*(Aq,\&                          \-script=>[\&                                    { \-type => \*(Aqtext/javascript\*(Aq,\&                                      \-src      => \*(Aq/javascript/utilities10.js\*(Aq\&                                    },\&                                    { \-type => \*(Aqtext/javascript\*(Aq,\&                                      \-src      => \*(Aq/javascript/utilities11.js\*(Aq\&                                    },\&                                    { \-type => \*(Aqtext/jscript\*(Aq,\&                                      \-src      => \*(Aq/javascript/utilities12.js\*(Aq\&                                    },\&                                    { \-type => \*(Aqtext/ecmascript\*(Aq,\&                                      \-src      => \*(Aq/javascript/utilities219.js\*(Aq\&                                    }\&                                 ]\&                             );.Ve.PPThe option \*(L"\-language\*(R" is a synonym for \-type, and is supported forbackwad compatibility..PPThe old-style positional parameters are as follows:.IP "\fBParameters:\fR" 4.IX Item "Parameters:".PD 0.IP "1." 4.IX Item "1.".PDThe title.IP "2." 4.IX Item "2."The author's e\-mail address (will create a <link rev=\*(L"\s-1MADE\s0\*(R"> tag if present.IP "3." 4.IX Item "3."A 'true' flag if you want to include a <base> tag in the header.  Thishelps resolve relative addresses to absolute ones when the document is moved, but makes the document hierarchy non-portable.  Use with care!.IP "4, 5, 6..." 4.IX Item "4, 5, 6..."Any other parameters you want to include in the <body> tag.  This is a goodplace to put Netscape extensions, such as colors and wallpaper patterns..Sh "\s-1ENDING\s0 \s-1THE\s0 \s-1HTML\s0 \s-1DOCUMENT:\s0".IX Subsection "ENDING THE HTML DOCUMENT:".Vb 1\&        print end_html.Ve.PPThis ends an \s-1HTML\s0 document by printing the </body></html> tags..Sh "\s-1CREATING\s0 A SELF-REFERENCING \s-1URL\s0 \s-1THAT\s0 \s-1PRESERVES\s0 \s-1STATE\s0 \s-1INFORMATION:\s0".IX Subsection "CREATING A SELF-REFERENCING URL THAT PRESERVES STATE INFORMATION:".Vb 2\&    $myself = self_url;\&    print q(<a href="$myself">I\*(Aqm talking to myself.</a>);.Ve.PP\&\fIself_url()\fR will return a \s-1URL\s0, that, when selected, will reinvokethis script with all its state information intact.  This is mostuseful when you want to jump around within the document usinginternal anchors but you don't want to disrupt the current contentsof the form(s).  Something like this will do the trick..PP.Vb 4\&     $myself = self_url;\&     print "<a href=\e"$myself#table1\e">See table 1</a>";\&     print "<a href=\e"$myself#table2\e">See table 2</a>";\&     print "<a href=\e"$myself#yourself\e">See for yourself</a>";.Ve.PPIf you want more control over what's returned, using the \fB\f(BIurl()\fB\fRmethod instead..PPYou can also retrieve the unprocessed query string with \fIquery_string()\fR:.PP.Vb 1\&    $the_string = query_string;.Ve.Sh "\s-1OBTAINING\s0 \s-1THE\s0 \s-1SCRIPT\s0'S \s-1URL\s0".IX Subsection "OBTAINING THE SCRIPT'S URL".Vb 7\&    $full_url      = url();\&    $full_url      = url(\-full=>1);  #alternative syntax\&    $relative_url  = url(\-relative=>1);\&    $absolute_url  = url(\-absolute=>1);\&    $url_with_path = url(\-path_info=>1);\&    $url_with_path_and_query = url(\-path_info=>1,\-query=>1);\&    $netloc        = url(\-base => 1);.Ve.PP\&\fB\f(BIurl()\fB\fR returns the script's \s-1URL\s0 in a variety of formats.  Calledwithout any arguments, it returns the full form of the \s-1URL\s0, includinghost name and port number.PP.Vb 1\&    http://your.host.com/path/to/script.cgi.Ve.PPYou can modify this format with the following named arguments:.IP "\fB\-absolute\fR" 4.IX Item "-absolute"If true, produce an absolute \s-1URL\s0, e.g..Sp.Vb 1\&    /path/to/script.cgi.Ve.IP "\fB\-relative\fR" 4.IX Item "-relative"Produce a relative \s-1URL\s0.  This is useful if you want to reinvoke yourscript with different parameters. For example:.Sp.Vb 1\&    script.cgi.Ve.IP "\fB\-full\fR" 4.IX Item "-full"Produce the full \s-1URL\s0, exactly as if called without any arguments.This overrides the \-relative and \-absolute arguments..IP "\fB\-path\fR (\fB\-path_info\fR)" 4.IX Item "-path (-path_info)"Append the additional path information to the \s-1URL\s0.  This can becombined with \fB\-full\fR, \fB\-absolute\fR or \fB\-relative\fR.  \fB\-path_info\fRis provided as a synonym..IP "\fB\-query\fR (\fB\-query_string\fR)" 4.IX Item "-query (-query_string)"Append the query string to the \s-1URL\s0.  This can be combined with\&\fB\-full\fR, \fB\-absolute\fR or \fB\-relative\fR.  \fB\-query_string\fR is providedas a synonym..IP "\fB\-base\fR" 4.IX Item "-base"Generate just the protocol and net location, as in http://www.foo.com:8000.IP "\fB\-rewrite\fR" 4.IX Item "-rewrite"If Apache's mod_rewrite is turned on, then the script name and pathinfo probably won't match the request that the user sent. Set\&\-rewrite=>1 (default) to return URLs that match what the user sent(the original request \s-1URI\s0). Set \-rewrite\->0 to return URLs that matchthe \s-1URL\s0 after mod_rewrite's rules have run. Because the additionalpath information only makes sense in the context of the rewritten \s-1URL\s0,\&\-rewrite is set to false when you request path info in the \s-1URL\s0..Sh "\s-1MIXING\s0 \s-1POST\s0 \s-1AND\s0 \s-1URL\s0 \s-1PARAMETERS\s0".IX Subsection "MIXING POST AND URL PARAMETERS".Vb 1\&   $color = url_param(\*(Aqcolor\*(Aq);.Ve.PPIt is possible for a script to receive \s-1CGI\s0 parameters in the \s-1URL\s0 aswell as in the fill-out form by creating a form that POSTs to a \s-1URL\s0containing a query string (a \*(L"?\*(R" mark followed by arguments).  The\&\fB\f(BIparam()\fB\fR method will always return the contents of the POSTedfill-out form, ignoring the \s-1URL\s0's query string.  To retrieve \s-1URL\s0parameters, call the \fB\f(BIurl_param()\fB\fR method.  Use it in the same way as\&\fB\f(BIparam()\fB\fR.  The main difference is that it allows you to read theparameters, but not set them..PPUnder no circumstances will the contents of the \s-1URL\s0 query stringinterfere with similarly-named \s-1CGI\s0 parameters in POSTed forms.  If youtry to mix a \s-1URL\s0 query string with a form submitted with the \s-1GET\s0method, the results will not be what you expect..SH "CREATING STANDARD HTML ELEMENTS:".IX Header "CREATING STANDARD HTML ELEMENTS:"\&\s-1CGI\s0.pm defines general \s-1HTML\s0 shortcut methods for most, if not all ofthe \s-1HTML\s0 3 and \s-1HTML\s0 4 tags.  \s-1HTML\s0 shortcuts are named after a single\&\s-1HTML\s0 element and return a fragment of \s-1HTML\s0 text that you can thenprint or manipulate as you like.  Each shortcut returns a fragment of\&\s-1HTML\s0 code that you can append to a string, save to a file, or, mostcommonly, print out so that it displays in the browser window..PPThis example shows how to use the \s-1HTML\s0 methods:.PP.Vb 7\&   print $q\->blockquote(\&                     "Many years ago on the island of",\&                     $q\->a({href=>"http://crete.org/"},"Crete"),\&                     "there lived a Minotaur named",\&                     $q\->strong("Fred."),\&                    ),\&       $q\->hr;.Ve.PPThis results in the following \s-1HTML\s0 code (extra newlines have beenadded for readability):.PP.Vb 6\&   <blockquote>\&   Many years ago on the island of\&   <a href="http://crete.org/">Crete</a> there lived\&   a minotaur named <strong>Fred.</strong> \&   </blockquote>\&   <hr>.Ve.PPIf you find the syntax for calling the \s-1HTML\s0 shortcuts awkward, you canimport them into your namespace and dispense with the object syntaxcompletely (see the next section for more details):.PP.Vb 8\&   use CGI \*(Aq:standard\*(Aq;\&   print blockquote(\&      "Many years ago on the island of",\&      a({href=>"http://crete.org/"},"Crete"),\&      "there lived a minotaur named",\&      strong("Fred."),\&      ),\&      hr;.Ve.Sh "\s-1PROVIDING\s0 \s-1ARGUMENTS\s0 \s-1TO\s0 \s-1HTML\s0 \s-1SHORTCUTS\s0".IX Subsection "PROVIDING ARGUMENTS TO HTML SHORTCUTS"The \s-1HTML\s0 methods will accept zero, one or multiple arguments.  If youprovide no arguments, you get a single tag:.PP.Vb 1\&   print hr;    #  <hr>.Ve.PPIf you provide one or more string arguments, they are concatenatedtogether with spaces and placed between opening and closing tags:.PP.Vb 1\&   print h1("Chapter","1"); # <h1>Chapter 1</h1>".Ve.PPIf the first argument is an associative array reference, then the keysand values of the associative array become the \s-1HTML\s0 tag's attributes:.PP.Vb 2\&   print a({\-href=>\*(Aqfred.html\*(Aq,\-target=>\*(Aq_new\*(Aq},\&      "Open a new frame");\&\&            <a href="fred.html",target="_new">Open a new frame</a>.Ve.PPYou may dispense with the dashes in front of the attribute names ifyou prefer:.PP.Vb 1\&   print img {src=>\*(Aqfred.gif\*(Aq,align=>\*(AqLEFT\*(Aq};\&\&           <img align="LEFT" src="fred.gif">.Ve.PPSometimes an \s-1HTML\s0 tag attribute has no argument.  For example, orderedlists can be m

⌨️ 快捷键说明

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