亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ch06_02.htm

?? 用perl編寫CGI的好書。本書從解釋CGI和底層HTTP協議如何工作開始
?? HTM
?? 第 1 頁 / 共 3 頁
字號:
<?label 6.2. Server Side Includes?><html><head><title>Server Side Includes (CGI Programming with Perl)</title><link href="../style/style1.css" type="text/css" rel="stylesheet" /><meta name="DC.Creator" content="Scott Guelich, Gunther Birznieks and Shishir Gundavaram" /><meta scheme="MIME" content="text/xml" name="DC.Format" /><meta content="en-US" name="DC.Language" /><meta content="O'Reilly & Associates, Inc." name="DC.Publisher" /><meta scheme="ISBN" name="DC.Source" content="1565924193L" /><meta name="DC.Subject.Keyword" content="stuff" /><meta name="DC.Title" content="CGI Programming with Perl" /><meta content="Text.Monograph" name="DC.Type" /></head><body bgcolor="#ffffff"><img src="gifs/smbanner.gif" alt="Book Home" usemap="#banner-map" border="0" /><map name="banner-map"><area alt="CGI Programming with Perl" href="index.htm" coords="0,0,466,65" shape="rect" /><area alt="Search this book" href="jobjects/fsearch.htm" coords="467,0,514,18" shape="rect" /></map><div class="navbar"><table border="0" width="515"><tr><td width="172" valign="top" align="left"><a href="ch06_01.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td width="171" valign="top" align="center"><a href="index.htm">CGI Programming with Perl</a></td><td width="172" valign="top" align="right"><a href="ch06_03.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr></table></div><hr align="left" width="515" /><h2 class="sect1">6.2. Server Side Includes</h2><p>Many times we want to create a web page that contains very littledynamic information. It seems like a lot of work to go through thetrouble of writing a full-fledged application in order to display asingle piece of <a name="INDEX-1241" />dynamic information such as the currentdate and time, file modification time, or the user's IPaddress, in an otherwise static document. Fortunately, there is atool included with most web servers called <em class="firstterm">Server SideIncludes</em><a name="INDEX-1242" />, or <em class="firstterm">SSI</em>.</p><p>SSI allows us to embed special directives in our HTML documents toexecute other programs or insert various pieces of data such asenvironment variables and file statistics. While SSI has technicallynothing to do with CGI, it is an important tool for incorporatingdynamic information, as well as output from CGI programs, intootherwise static documents, and you should definitely be aware of itsabilities and limitations because in some cases it can provide asimpler and more efficient solution than a CGI script.</p><p>For example, say you want to have a web page display the<a name="INDEX-1243" /> <a name="INDEX-1,244" />last date it was modified. You couldcreate a CGI script to display the file and use Perl's<tt class="literal">-M</tt><a name="INDEX-1245" /><a name="INDEX-1246" /> operator to determine the age of thefile. However, it's much simpler to enable SSI and include thefollowing line:</p><blockquote><pre class="code">Last modified: &lt;!--#echo var="LAST_MODIFIED" --&gt;</pre></blockquote><p>The terms within the HTML comment are an SSI command. When thebrowser requests this document from a web server, the server parsesit and returns the result (see <a href="ch06_02.htm#ch06-69027">Figure 6-1</a>). In thiscase, it replaces the SSI command with a timestamp reflecting thelast time this document was modified. The server does notautomatically parse all files looking for SSI directives, but onlydocuments that are associated with SSI. We will look at how toconfigure this in the next section.</p><a name="ch06-2-fm2xml" /><blockquote><h4 class="objtitle">NOTE</h4><p>Note that <a name="INDEX-1247" /> <a name="INDEX-1,248" /><a name="INDEX-1249" /><a name="INDEX-1250" />SSI cannot parse CGI output; it onlyparses otherwise static HTML files. The new architecture in Apache2.0 should eventually support SSI parsing of CGI output if the CGIoutputs a particular <em class="emphasis">Content-type</em> header. Otherweb servers do not support this.</p></blockquote><p>Because the SSI engine is compiled into the web server, it is manytimes more efficient than a CGI script. However,<a name="INDEX-1251" /><a name="INDEX-1252" />SSIcommands are limited and can only handle basic tasks; in one sensethis simplicity is good because SSI is very easy to learn. HTMLdesigners with no programming experience can easily add SSI commandsto their documents. Later in this chapter we'll see how othertemplate solutions provide more powerful alternatives aimed atdevelopers.</p><a name="ch06-69027" /><div class="figure"><img width="460" src="figs/cgi2.0601.gif" height="267" alt="Figure 6-1" /></div><h4 class="objtitle">Figure 6-1. Server side includes</h4><a name="ch06-14723" /><div class="sect2"><h3 class="sect2">6.2.1. Configuration</h3><p>The <a name="INDEX-1253" /> <a name="INDEX-1,254" />server must know which files toparse for SSI commands. We'll see how to configure the Apacheweb server in this section. If you are using another web server, itshould be equally easy to configure; refer to its documentation.</p><p>You have the following options with SSI:</p><ul><li><p>You may configure the web server to only recognize SSI documents in aparticular directory or directories or throughout the entire site.</p></li><li><p>You can configure the web server to parse all HTML documents for SSIcommands or just documents with a particular extension (typically<em class="filename">.shtml </em><a name="INDEX-1255" />).</p></li><li><p>You can set whether SSI commands have the ability to execute externalprograms in order to generate their output. This can be useful, butit can also be a security risk.</p></li></ul><p>To enable SSI for a particular directory or<a name="INDEX-1256" />directories, add<tt class="literal">Includes</tt> as an option in each directory. If youwish to enable SSI throughout your <a name="INDEX-1257" />web site for all files ending in<em class="filename">.shtml</em>, then add the following to<em class="filename">httpd.conf</em> (or <em class="filename">access.conf</em>if used):</p><blockquote><pre class="code">&lt;Location /&gt;...Options     IncludesAddHandler  server-parsed .shtml...	&lt;/Location&gt;</pre></blockquote><p>Note that your configuration files probably have other lines betweenthe &lt;Location /&gt; and &lt;/Location&gt; tags as well as otherentries for <tt class="literal">Options</tt>; you can leave these as theyare.</p><p>You are not restricted to using the <em class="firstterm">.shtml</em>extension; you can have the<a name="INDEX-1258" />serverparse all HTML documents with this directive:</p><blockquote><pre class="code">AddHandler server-parsed .html</pre></blockquote><p>However, you should do this only if all of your pages are dynamicbecause parsing each HTML document increases the amount of work theweb server must do and reduces performance.</p><p>You should also add the following lines to<em class="filename">httpd.conf</em><a name="INDEX-1259" /><a name="INDEX-1260" /> <a name="INDEX-1,261" /> outside any<tt class="literal">Location</tt> or <tt class="literal">Directory</tt> tags (or<em class="filename">srm.conf,</em> if used):</p><blockquote><pre class="code">DirectoryIndex   index.html index.shtmlAddType          text/html     .shtml</pre></blockquote><p>The <tt class="literal">DirectoryIndex</tt> directive tells the server thatif the URL refers to a directory and that directory contains<em class="filename">index.shtml</em>, then it should display it if<em class="filename">index.html</em> is not found. The<tt class="literal">AddType</tt> server directive tells the server that themedia type of parsed files is HTML instead of the default, which istypically plain text.</p><p>We'll look at the syntax of SSI commands in a moment, but oneparticular <a name="INDEX-1262" /> <a name="INDEX-1,263" />SSI command,<tt class="command">exec</tt>, allows you to execute<a name="INDEX-1264" /><a name="INDEX-1265" /><a name="INDEX-1266" /><a name="INDEX-1267" />externalapplications and include the output in your document. You may notwish to enable thisfor<a name="INDEX-1268" /> security reasons;you may not wish to give HTML authors the same level of trust in thisregard that you give to CGI developers. Also, if you do enable<tt class="command">exec</tt> and you have a CGI script on your site thatcreates static HTML files from users' input (as some popularguestbook and message board CGI scripts do), make sure that SSI isnot enabled for files created by this CGI script. If someone usingthis CGI script enters the following and SSI tags are not removed bythe CGI application, then their malicious command will be executedthe first time their comment is read:</p><blockquote><pre class="code">&lt;!--#exec cmd="/bin/rm -rf *" --&gt;</pre></blockquote><p>This would remove all the files from all the directories the servercan write to. The following could be just as disastrous on a Windowsserver:</p><blockquote><pre class="code">&lt;!--#exec cmd="del /f /s /q c:\" --&gt;</pre></blockquote><p>Most CGI scripts that generate files such as this create them with a<em class="filename">.html</em> extension, so you would not want to enable<tt class="command">exec</tt> and configure the web server to parse all<em class="filename">.html</em> files. Note that this is not as much of aconcern if CGI scripts are not allowed to generate<em class="filename">.html</em> files.</p><p>To enable <a name="INDEX-1269" />SSI without enabling the<tt class="literal">exec</tt> tag, use the following option instead of<tt class="literal">Includes</tt>:</p><blockquote><pre class="code">Options     IncludesNoExec</pre></blockquote><p>Older versions of Apache and other web <a name="INDEX-1270" />servers actuallyrequired that the CGI script execution also be enabled in order touse the <tt class="command">exec</tt> command:</p><blockquote><pre class="code">Options     Includes ExecCGI</pre></blockquote><p>As you'll recall from <a href="ch01_01.htm">Chapter 1, "Getting Started "</a>, there aregood reasons to restrict CGI scripts to particular directories.Previously you had to choose between enabling CGI script executionand disallowing the <tt class="command">exec</tt> command. Fortunately,this restriction has been lifted: you can now<a name="INDEX-1271" /> <a name="INDEX-1,272" />enable the<tt class="command">exec</tt> command while disallowing <a name="INDEX-1273" /> <a name="INDEX-1,274" />CGI execution.</p></div><a name="ch06-3-fm2xml" /><div class="sect2"><h3 class="sect2">6.2.2. Format</h3><p>Now let's see what <a name="INDEX-1275" /><a name="INDEX-1276" /><a name="INDEX-1277" />SSI can do for us. All SSI directiveshave the following syntax:</p><blockquote><pre class="code">&lt;!--#element attribute="value" attribute="value" ... --&gt;</pre></blockquote><p><a href="ch06_02.htm#ch06-63191">Table 6-1</a> lists the available SSI commands. Inthis chapter, we will discuss each of these directives in detail.</p><a name="ch06-63191" /><h4 class="objtitle">Table 6-1. Server Side Include Commands </h4><table border="1"><tr><th><p>Element</p></th><th><p><a name="INDEX-1278" />Attribute</p></th><th><p>Description</p></th></tr><tr><td><p><tt class="command">echo</tt><a name="INDEX-1279" /></p></td><td><p><tt class="command">var</tt></p></td><td><p>Displays the value of environment variables, special SSI variablesand any user-defined variables.</p></td></tr><tr><td><p><tt class="command">include</tt><a name="INDEX-1280" /></p></td><td /><td><p>Inserts the contents of a particular file into the current document</p></td></tr><tr><td /><td><p><tt class="command">file</tt></p></td><td><p>Path of the file relative to the current directory, you cannot use anabsolute path or reference files outside the document root; the filecontents are included directly into the page with no additionalprocessing.</p></td></tr><tr><td /><td><p><tt class="command">virtual</tt></p></td><td><p>Virtual path (URL) relative to the document root; the serverinterprets the path just as if it were another HTTP request, so youcan use this attribute to insert the results of a CGI program oranother SSI document.</p></td></tr><tr><td><p><tt class="command">fsize</tt><a name="INDEX-1281" /></p></td><td /><td><p>Inserts the size of a file.</p></td></tr><tr><td /><td><p><tt class="command">file</tt></p></td><td><p>Path of the file relative to the current directory.</p></td></tr><tr><td /><td><p><tt class="command">virtual</tt></p></td><td><p>Virtual path (URL) relative to the document root.</p></td></tr><tr><td><p><tt class="command">flastmod</tt><a name="INDEX-1282" /></p></td><td><p><tt class="command">file</tt></p></td><td><p>Inserts the last modification date and time for a specified file.</p></td></tr><tr><td><p><tt class="command">exec</tt><a name="INDEX-1283" /></p></td><td /><td><p>Executes external programs and inserts the output in current document(unless SSI has been configured with<tt class="literal">IncludesNoExec</tt>).</p></td></tr><tr><td /><td><p><tt class="command">cmd</tt></p></td><td><p>Path to any executable application relative to the current directory.</p></td></tr><tr><td /><td><p><tt class="command">cgi</tt></p></td><td><p>Virtual path to a CGI program; however, you<em class="emphasis">cannot</em> pass a query string -- if you want topass a query string, use <tt class="literal">#include</tt><tt class="literal">virtual="..."</tt> instead.</p></td></tr><tr><td>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人精品一区二区三区四区| 精品免费日韩av| 在线91免费看| 国产精品丝袜一区| 秋霞成人午夜伦在线观看| 成人网页在线观看| 日韩精品一区二区三区在线| 亚洲与欧洲av电影| 成人免费看片app下载| 日韩精品中文字幕一区二区三区| 一区二区三区在线播放| 成人激情黄色小说| 久久精品夜夜夜夜久久| 奇米888四色在线精品| 欧美性大战久久| 亚洲柠檬福利资源导航| 成人免费观看av| 欧美国产精品一区二区三区| 国内精品伊人久久久久av影院| 91精品国产乱| 无码av免费一区二区三区试看 | 欧美日韩国产综合一区二区 | 午夜亚洲福利老司机| 成人性生交大片免费看视频在线| 欧美成人video| 琪琪一区二区三区| 91精品国产综合久久精品性色 | 久久99国内精品| 欧美一级日韩一级| 日韩国产高清影视| 欧美久久久一区| 日韩不卡一区二区三区| 欧美美女网站色| 三级一区在线视频先锋| 欧美精品丝袜久久久中文字幕| 亚洲福利视频一区二区| 91精品国产综合久久久蜜臀图片| 免费看精品久久片| 精品国产一区久久| 国产精品自拍在线| 国产精品免费免费| 色婷婷亚洲综合| 午夜精品一区二区三区三上悠亚| 欧美精品久久天天躁| 蜜桃精品在线观看| 欧美国产日本视频| 色国产综合视频| 日韩中文字幕区一区有砖一区 | 国产日韩视频一区二区三区| 成人免费视频视频| 亚洲精品成人少妇| 欧美猛男男办公室激情| 精品中文字幕一区二区小辣椒| 久久久国产综合精品女国产盗摄| 大尺度一区二区| 亚洲综合精品自拍| 日韩一区二区免费在线观看| 国产精品12区| 一区二区三区高清不卡| 欧美第一区第二区| 97se狠狠狠综合亚洲狠狠| 亚洲综合色噜噜狠狠| 欧美大尺度电影在线| 成人av动漫网站| 日韩激情一二三区| 国产精品国产a| 在线不卡免费欧美| 不卡在线视频中文字幕| 日韩精品亚洲专区| 国产精品网站一区| 欧美一区二区私人影院日本| 国产成人精品一区二| 亚洲成人免费在线观看| 国产日韩欧美制服另类| 欧美高清性hdvideosex| 国产精品一区二区在线观看不卡 | 欧美高清在线精品一区| 色88888久久久久久影院按摩 | 久久男人中文字幕资源站| 在线观看网站黄不卡| 国产一区二区免费视频| 日韩精品免费视频人成| 亚洲色图丝袜美腿| 国产日韩欧美电影| 666欧美在线视频| 色综合久久久久综合体| 国产毛片精品一区| 日韩激情av在线| 一区二区三区四区激情| 欧美经典三级视频一区二区三区| 欧美一级二级三级蜜桃| 欧美日韩综合一区| 99久久精品99国产精品| 国产91精品免费| 极品少妇一区二区| 蜜桃91丨九色丨蝌蚪91桃色| 一区二区在线看| 中文字幕一区日韩精品欧美| 久久久不卡网国产精品一区| 欧美裸体bbwbbwbbw| 在线影视一区二区三区| 成人av网址在线| 不卡一区二区三区四区| 国产成人午夜精品5599| 激情综合色丁香一区二区| 免费三级欧美电影| 日本成人中文字幕在线视频| 亚洲福中文字幕伊人影院| 亚洲宅男天堂在线观看无病毒| 亚洲三级免费观看| 综合激情成人伊人| ...av二区三区久久精品| 国产精品久久久久影视| 国产精品蜜臀在线观看| 中文字幕日韩欧美一区二区三区| 国产伦理精品不卡| 亚洲国产欧美另类丝袜| 亚洲精品欧美专区| 一区二区在线观看免费视频播放| 亚洲色图清纯唯美| 一级特黄大欧美久久久| 亚洲大尺度视频在线观看| 亚洲国产欧美另类丝袜| 婷婷久久综合九色综合绿巨人| 视频一区国产视频| 精品在线亚洲视频| 国产精品一区二区果冻传媒| 久久久久久久久久久99999| 国产成人精品三级| 国产精品一区2区| 成人免费高清在线观看| 91免费观看国产| 色婷婷激情综合| 欧美日韩国产高清一区| 欧美一级理论片| 久久在线观看免费| 国产精品每日更新在线播放网址| 亚洲美女视频一区| 午夜一区二区三区在线观看| 蜜桃精品视频在线| 成人免费视频播放| 欧洲中文字幕精品| 日韩一二三四区| 中文字幕av免费专区久久| 一区二区三区丝袜| 蜜桃av一区二区| www.日韩av| 欧美精选午夜久久久乱码6080| 久久久亚洲精品石原莉奈| 亚洲人一二三区| 免费高清视频精品| av亚洲精华国产精华精华| 欧美色图片你懂的| 久久精品亚洲一区二区三区浴池| 18欧美乱大交hd1984| 美国十次了思思久久精品导航| 成人av网在线| 日韩欧美国产三级电影视频| 亚洲色图色小说| 国内精品久久久久影院一蜜桃| 色婷婷激情综合| 国产视频一区二区在线| 午夜a成v人精品| www.欧美色图| 欧美精品一区二区三区四区| 亚洲精品伦理在线| 国产成人av电影在线观看| 欧美三级电影精品| 国产精品白丝在线| 国产原创一区二区| 7777女厕盗摄久久久| 亚洲欧美日韩久久| 国产在线一区二区综合免费视频| 在线观看不卡一区| 亚洲欧美在线视频| 国产一区不卡精品| 欧美一区二区性放荡片| 亚洲福利一区二区三区| 91猫先生在线| 亚洲欧洲美洲综合色网| 国产福利91精品一区| 26uuu精品一区二区三区四区在线| 午夜婷婷国产麻豆精品| 欧美天堂一区二区三区| 一区二区三区美女视频| 色综合天天综合网天天狠天天| 国产精品网站在线| 成人v精品蜜桃久久一区| 欧美极品美女视频| 粉嫩aⅴ一区二区三区四区五区| 久久综合国产精品| 国产一区二区三区免费观看| 日韩精品专区在线| 国产在线精品一区在线观看麻豆| 欧美xxxx在线观看| 国产一二精品视频| 国产三级精品视频| a级精品国产片在线观看| 国产精品麻豆视频| 91啦中文在线观看|