﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-空穴来风-随笔分类-WebDevelope</title><link>http://www.cppblog.com/bigsml/category/7604.html</link><description /><language>zh-cn</language><lastBuildDate>Thu, 21 Jan 2010 22:22:09 GMT</lastBuildDate><pubDate>Thu, 21 Jan 2010 22:22:09 GMT</pubDate><ttl>60</ttl><item><title>Top 25 PHP template engines </title><link>http://www.cppblog.com/bigsml/archive/2008/10/29/65478.html</link><dc:creator>泡泡牛</dc:creator><author>泡泡牛</author><pubDate>Wed, 29 Oct 2008 13:28:00 GMT</pubDate><guid>http://www.cppblog.com/bigsml/archive/2008/10/29/65478.html</guid><wfw:comment>http://www.cppblog.com/bigsml/comments/65478.html</wfw:comment><comments>http://www.cppblog.com/bigsml/archive/2008/10/29/65478.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/bigsml/comments/commentRss/65478.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/bigsml/services/trackbacks/65478.html</trackback:ping><description><![CDATA[zz <a href="http://www.whenpenguinsattack.com/2006/07/19/php-template-engine-roundup/">http://www.whenpenguinsattack.com/2006/07/19/php-template-engine-roundup/</a>&nbsp;<br>
<p><br>该文总结了 php 的一些模板. 我使用过的有smarty, template lib, 还有后来用的 Savant. 感觉smarty 太复杂了, template lib 需要学习一些标签, 并且不是很强大, 综合考虑还是Savant 最好, 既可以使用模板机制, 另外页面模板直接使用php 函数来输出. 功能也还可以. <br><br><a href="http://smarty.php.net/"><u><font color=#0000ff>Smarty</font></u></a><br>Smarty is a template engine that compiles the templates into PHP scripts, then executes those scripts. Very fast, very flexible.</p>
<p><a href="http://phpsavant.com/"><u><font color=#800080>Savant</font></u></a><br>A powerful but lightweight PEAR-compliant template system. It is non-compiling, and uses PHP itself as its template language.<br><a href="http://www.phpguru.org/static/template.html"><u><font color=#0000ff><br>Heyes Template Class</font></u></a><br>A very easy to use, yet powerful and quick template engine that enables you to separate your page layout and design from your code.</p>
<p><a href="http://www.thewebmasters.net/php/FastTemplate.phtml"><u><font color=#0000ff>FastTemplate</font></u></a><br>A simple variable interpolation template class that parses your templates for variables and spits out HTML with their values</p>
<p><a href="http://www.maiatech.com/shellpage.php"><u><font color=#0000ff>ShellPage</font></u></a><br>A simple and easy to use class that lets you make whole websites based on template files for layouts. Change the template and your whole site changes.</p>
<p><a href="http://www.script.gr/go/scripts/STP/"><u><font color=#0000ff>STP Simple Template Parser</font></u></a><br>A simple, light weight and easy to use template parser class. It can assemble a page from several templates, output result pages to the browser or write them to the filesystem.</p>
<p><a href="http://www.net-track.ch/opensource/template/"><u><font color=#0000ff>OO Template Class</font></u></a><br>An object oriented template class you can use in your own programs.</p>
<p><a href="http://sourceforge.net/projects/simpletpl"><u><font color=#0000ff>SimpleTemplate</font></u></a><br>A template engine to create and structure websites and applications. It can translate and compile the templates.</p>
<p><a href="http://www.massassi.com/bTemplate/"><u><font color=#0000ff>bTemplate</font></u></a><br>A small and fast template class that allows you to separate your PHP logic from your HTML presentation code.</p>
<p><a href="http://ets.sourceforge.net/"><u><font color=#0000ff>ETS - easy template system</font></u></a><br>A template system that allows you to reshuffle templates with exactly the same data.</p>
<p><a href="http://macdeviant.com/scripts/template/index.php"><u><font color=#0000ff>EasyTemplatePHP</font></u></a><br>A simple, yet powerful templating system for your site.</p>
<p><a href="http://vlib.activefish.com/"><u><font color=#0000ff>vlibTemplate</font></u></a><br>A fast, full featured template system that includes a caching and debugging class.</p>
<p><a href="http://avantemplate.sourceforge.net/"><u><font color=#0000ff>AvanTemplate</font></u></a><br>A template engine that is multi-byte safe and consumes little computing resource. It supports variable replacement and content blocks that can be set to hidden or shown.</p>
<p><a href="http://www.grafxsoftware.com/product.php?id=26"><u><font color=#0000ff>Grafx Software&#8217;s Fast Template</font></u></a><br>A modification of the popular Fast Template system, this includes a cache function, debug console, and silent removal of unassigned dynamic blocks.</p>
<p><a href="http://templatepower.codocad.com/"><u><font color=#0000ff>TemplatePower</font></u></a><br>A fast, simple and powerful template class. Features nested dynamic block support, block/file include support and show/hide unassigned variables.</p>
<p><a href="http://www.virtualcreations.com.au/mark/tagtemplate.htm"><u><font color=#0000ff>TagTemplate</font></u></a><br>This library function was designed for use with template files and allows you to retrieve info from HTML files.</p>
<p><a href="http://htmltmpl.sourceforge.net/"><u><font color=#0000ff>htmltmpl: templating engine</font></u></a><br>A templating engine for Python and PHP. Targeted to web application developers, who want to separate program code and design of their projects.</p>
<p><a href="http://www.cmarshall.net/DreamweaverTemplate"><u><font color=#0000ff>PHP Class for Parsing Dreamweaver templates</font></u></a><br>A simple class to parse a Dreamweaver template for use in custom mods for a Gallery 2 and a WordPress blog.</p>
<p><a href="http://www.source-code.biz/"><u><font color=#0000ff>MiniTemplator (Template Engine)</font></u></a><br>A compact template engine for HTML files. It features a simple syntax for template variables and blocks. Blocks can be nested.</p>
<p><a href="http://www.analysisandsolutions.com/software/layout/layout.htm"><u><font color=#0000ff>Layout Solution</font></u></a><br>Simplifies website development and maintenance. It holds commonly used variables and page elements so you don&#8217;t need to duplicate common layouts over and over.</p>
<p><a href="http://zoned.net:81/~xkahn/php/fasttemplate/"><u><font color=#0000ff>Cached Fast Template</font></u></a><br>This inclusion into <a href="http://php.resourceindex.com/detail/00015.html"><u><font color=#0000ff>FastTemplate</font></u></a> allows for caching of the template files, and can even cache with different specifications on separate blocks of content.</p>
<p><a href="http://www.tinybutstrong.com/"><u><font color=#0000ff>TinyButStrong</font></u></a><br>A template engine that supports MySQL, Odbc, Sql-Server and ADODB. It includes seven methods and two properties.</p>
<p><a href="http://www.sitepoint.com/article/beyond-template-engine"><u><font color=#0000ff>Brian Lozier&#8217;s php based template engine</font></u></a><br>Only 2k in size, very fast and object-orientated.</p>
<p><a href="http://www.phpwact.org/"><u><font color=#0000ff>WACT</font></u></a><br>a template engine that separates code from design.</p>
<p><a href="http://phptal.motion-twin.com/"><u><font color=#0000ff>PHPTAL</font></u></a><br>a XML/XHTML template library for PHP. <br><br>ref:<br><a href="http://www.sitepoint.com/forums/showthread.php?t=123769">http://www.sitepoint.com/forums/showthread.php?t=123769</a>&nbsp;对其他的php 模板进行了讨论</p>
<img src ="http://www.cppblog.com/bigsml/aggbug/65478.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/bigsml/" target="_blank">泡泡牛</a> 2008-10-29 21:28 <a href="http://www.cppblog.com/bigsml/archive/2008/10/29/65478.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Http 基础</title><link>http://www.cppblog.com/bigsml/archive/2008/09/25/62754.html</link><dc:creator>泡泡牛</dc:creator><author>泡泡牛</author><pubDate>Thu, 25 Sep 2008 06:05:00 GMT</pubDate><guid>http://www.cppblog.com/bigsml/archive/2008/09/25/62754.html</guid><wfw:comment>http://www.cppblog.com/bigsml/comments/62754.html</wfw:comment><comments>http://www.cppblog.com/bigsml/archive/2008/09/25/62754.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/bigsml/comments/commentRss/62754.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/bigsml/services/trackbacks/62754.html</trackback:ping><description><![CDATA[<p>= HTTP 基础 <br>一个完整的 HTTP 请求可以分成4步: <br>&nbsp;1. 创建TCP socket, 连接到Web 服务器<br>&nbsp;2. 发送Http 请求头<br>&nbsp;3. 接受Web 响应数据<br>&nbsp;4. 关闭socket 连接<br>整个流程可以通过telnet hostname 80 来模拟<br>一个完整的请求例子如下 <br>* About to connect() to <a href="http://www.baidu.com/">www.baidu.com</a> port 80 (#0)<br>*&nbsp;&nbsp; Trying 202.108.22.5... connected<br>* Connected to <a href="http://www.baidu.com/">www.baidu.com</a> (202.108.22.5) port 80 (#0)<br>&gt; GET / HTTP/1.1<br>&gt; User-Agent: curl/7.16.4 (i586-pc-mingw32msvc) libcurl/7.16.4 OpenSSL/0.9.7e zlib/1.2.2<br>&gt; Host: <a href="http://www.baidu.com/">www.baidu.com</a><br>&gt; Accept: */*<br>&gt;<br>&lt; HTTP/1.1 200 OK<br>&lt; Date: Thu, 25 Sep 2008 05:14:30 GMT<br>&lt; Server: BWS/1.0<br>&lt; Content-Length: 3342<br>&lt; Content-Type: text/html<br>&lt; Cache-Control: private<br>&lt; Expires: Thu, 25 Sep 2008 05:14:30 GMT<br>&lt; Set-Cookie: BAIDUID=3A8165EF68FFEE5F605D33ADEF300BA1:FG=1; expires=Thu, 25-Sep-38 05:14:30 GMT; path=/; domain=.baidu.com<br>&lt; P3P: CP=" OTI DSP COR IVA OUR IND COM "<br>&lt;<br>&lt;html&gt;&lt;head&gt;&lt;meta http-equiv=Content-Type content="text/html;charset=gb2312"&gt;&lt;title&gt;...... </p>
<p>另外值得说明的是, HTTP 请求是无状态的，表明在处理一个请求时，Web服务器并不记住来自同一客户端的请求。</p>
<p>= Http 请求头 <br>包含4个部分: 请求行、请求头、空行和请求数据</p>
<p>1. 请求行<br>由三个标记组成：请求方法、请求URI和HTTP版本，它们用空格分隔, 如：GET /index.html HTTP/1.1 </p>
<p>HTTP 规范定义了8种请求方法：<br>GET &nbsp;&nbsp;检索URI中标识资源的一个简单请求<br>HEAD &nbsp;&nbsp;与GET方法相同，服务器只返回状态行和头标，并不返回请求文档<br>POST &nbsp;&nbsp;服务器接受被写入客户端输出流中的数据的请求<br>PUT &nbsp;&nbsp;服务器保存请求数据作为指定URI新内容的请求<br>DELETE &nbsp;&nbsp;服务器删除URI中命名的资源的请求<br>OPTIONS &nbsp;关于服务器支持的请求方法信息的请求<br>TRACE &nbsp;&nbsp;Web服务器反馈Http请求和其头标的请求<br>CONNECT &nbsp;已文档化但当前未实现的一个方法，预留做隧道处理</p>
<p>2. 请求头 [ 可无 ]<br>由关键字及值对组成，每行一对，关键字和值用冒号（:）分隔。如<br>&gt; User-Agent: curl/7.16.4 (i586-pc-mingw32msvc) libcurl/7.16.4 OpenSSL/0.9.7e zlib/1.2.2<br>&gt; Host: <a href="http://www.baidu.com/">www.baidu.com</a><br>&gt; Accept: */*<br>具体请求头如后所列 </p>
<p>3. 空行<br>最后一个请求头之后是一个空行，发送回车符和退行，通知服务器以下不再有头标。</p>
<p>4. 请求数据 [ 可无 ]<br>使用POST传送数据，最常使用的是Content-Type和Content-Length头标 </p>
<p><br>= Web 响应 <br>由四个部分组成: 状态行、响应头、空行、响应数据, 如: <br>&lt; HTTP/1.1 200 OK<br>&lt; Date: Thu, 25 Sep 2008 05:14:30 GMT<br>&lt; Server: BWS/1.0<br>&lt; Content-Length: 3342<br>&lt; Content-Type: text/html<br>&lt; Cache-Control: private<br>&lt; Expires: Thu, 25 Sep 2008 05:14:30 GMT<br>&lt; Set-Cookie: BAIDUID=3A8165EF68FFEE5F605D33ADEF300BA1:FG=1; expires=Thu, 25-Sep-38 05:14:30 GMT; path=/; domain=.baidu.com<br>&lt; P3P: CP=" OTI DSP COR IVA OUR IND COM "<br>&lt;<br>&lt;html&gt;&lt;head&gt;&lt;meta http-equiv=Content-Type content="text/html;charset=gb2312"&gt;&lt;title&gt;...... </p>
<p>1.状态行<br>由三个标记组成：HTTP版本、响应代码和响应描述<br>HTTP版本:: 向客户端指明其可理解的最高版本。<br>响应代码:: 3位的数字代码，指出请求的成功或失败，如果失败则指出原因。<br>响应描述:: 为响应代码的可读性解释。<br>如 <br>&lt; HTTP/1.1 200 OK </p>
<p>HTTP响应码划分如下(祥见后)：<br>1xx：信息，请求收到，继续处理<br>2xx：成功，行为被成功地接受、理解和采纳<br>3xx：重定向，为了完成请求，必须进一步执行的动作<br>4xx：客户端错误</p>
<p><br>2.响应头<br>跟请求头一样，它们指出服务器的功能，标识出响应数据的细节。</p>
<p>3.空行<br>最后一个响应头标之后是一个空行，发送回车符和退行，表明服务器以下不再有头标。</p>
<p>4.响应数据<br>HTML文档和图像等，就是HTML本身。 </p>
<p><br>= HTTP头<br>用以描述客户端或者服务器的属性、被传输的资源等, 分为<br>1.通用头标：即可用于请求，也可用于响应，是作为一个整体而不是特定资源与事务相关联。<br>2.请求头标：允许客户端传递关于自身的信息和希望的响应形式。<br>3.响应头标：服务器和于传递自身信息的响应。<br>4.实体头标：定义被传送资源的信息。即可用于请求，也可用于响应。</p>
<p>下表描述在HTTP/1.1中用到的头标<br>Accept &nbsp;&nbsp;定义客户端可以处理的媒体类型，按优先级排序；<br>&nbsp;&nbsp;在一个以逗号为分隔的列表中，可以定义多种类型和使用通配符。例如：Accept: image/jpeg,image/png,*/*<br>Accept-Charset &nbsp;定义客户端可以处理的字符集，按优先级排序；<br>&nbsp;&nbsp;在一个以逗号为分隔的列表中，可以定义多种类型和使用通配符。例如：Accept-Charset: iso-8859-1,*,utf-8<br>Accept-Encoding 定义客户端可以理解的编码机制。例如：Accept-Encoding:gzip,compress<br>Accept-Language 定义客户端乐于接受的自然语言列表。例如：Accept-Language: en,de<br>Accept-Ranges &nbsp;一个响应头标，它允许服务器指明：将在给定的偏移和长度处，为资源组成部分的接受请求。<br>&nbsp;&nbsp;该头标的值被理解为请求范围的度量单位。例如Accept-Ranges: bytes或Accept-Ranges: none<br>Age &nbsp;&nbsp;允许服务器规定自服务器生成该响应以来所经过的时间长度，以秒为单位。<br>&nbsp;&nbsp;该头标主要用于缓存响应。例如：Age: 30<br>Allow &nbsp;&nbsp;一个响应头标，它定义一个由位于请求URI中的次源所支持的HTTP方法列表。例如：Allow: GET,PUT<br>AUTHORIZATION &nbsp;一个响应头标，用于定义访问一种资源所必需的授权（域和被编码的用户ID与口令）。<br>&nbsp;&nbsp;例如：Authorization: Basic YXV0aG9yOnBoaWw=<br>Cache-Control &nbsp;一个用于定义缓存指令的通用头标。例如：Cache-Control: max-age=30<br>Connection &nbsp;一个用于表明是否保存socket连接为开放的通用头标。例如：Connection: close或Connection: keep-alive<br>Content-Base &nbsp;一种定义基本URI的实体头标，为了在实体范围内解析相对URLs。<br>&nbsp;&nbsp;如果没有定义Content-Base头标解析相对URLs，使用Content-Location URI（存在且绝对）或使用URI请求。<br>&nbsp;&nbsp;例如：Content-Base: <a href="http://www.myweb.com/">Http://www.myweb.com</a><br>Content-Encoding 一种介质类型修饰符，标明一个实体是如何编码的。例如：Content-Encoding: zip<br>Content-Language 用于指定在输入流中数据的自然语言类型。例如：Content-Language: en<br>Content-Length&nbsp;指定包含于请求或响应中数据的字节长度。例如：Content-Length:382<br>Content-Location 指定包含于请求或响应中的资源定位（URI）。<br>&nbsp;&nbsp;如果是一绝。对URL它也作为被解析实体的相对URL的出发点。<br>&nbsp;&nbsp;例如：Content-Location: <a href="http://www.myweb.com/news">http://www.myweb.com/news</a><br>Content-MD5 &nbsp;实体的一种MD5摘要，用作校验和。<br>&nbsp;&nbsp;发送方和接受方都计算MD5摘要，接受方将其计算的值与此头标中传递的值进行比较。<br>&nbsp;&nbsp;例如：Content-MD5: &lt;base64 of 128 MD5 digest&gt;<br>Content-Range &nbsp;随部分实体一同发送；标明被插入字节的低位与高位字节偏移，也标明此实体的总长度。<br>&nbsp;&nbsp;例如：Content-Range: 1001-2000/5000<br>Contern-Type &nbsp;标明发送或者接收的实体的MIME类型。例如：Content-Type: text/html<br>Date &nbsp;&nbsp;发送HTTP消息的日期。例如：Date: Mon,10PR 18:42:51 GMT<br>ETag &nbsp;&nbsp;一种实体头标，它向被发送的资源分派一个唯一的标识符。<br>&nbsp;&nbsp;对于可以使用多种URL请求的资源，ETag可以用于确定实际被发送的资源是否为同一资源。<br>&nbsp;&nbsp;例如：ETag: "208f-419e-30f8dc99"<br>Expires &nbsp;指定实体的有效期。例如：Expires: Mon,05 Dec 2008 12:00:00 GMT<br>Form &nbsp;&nbsp;一种请求头标，给定控制用户代理的人工用户的电子邮件地址。例如：From: <a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#119;&#101;&#98;&#109;&#97;&#115;&#116;&#101;&#114;&#64;&#109;&#121;&#119;&#101;&#98;&#46;&#99;&#111;&#109;">webmaster@myweb.com</a><br>Host &nbsp;&nbsp;被请求资源的主机名。对于使用HTTP/1.1的请求而言，此域是强制性的。例如：Host: <a href="http://www.myweb.com/">www.myweb.com</a><br>If-Modified-Since 如果包含了GET请求，导致该请求条件性地依赖于资源上次修改日期。<br>&nbsp;&nbsp;如果出现了此头标，并且自指定日期以来，此资源已被修改，应该反回一个304响应代码。<br>&nbsp;&nbsp;例如：If-Modified-Since: Mon,10PR 18:42:51 GMT<br>&nbsp;&nbsp;If-Match 如果包含于一个请求，指定一个或者多个实体标记。只发送其ETag与列表中标记区配的资源。<br>&nbsp;&nbsp;例如：If-Match: "208f-419e-308dc99"<br>&nbsp;&nbsp;If-None-Match 如果包含一个请求，指定一个或者多个实体标记。资源的ETag不与列表中的任何一个条件匹配，操作才执行。<br>&nbsp;&nbsp;例如：If-None-Match: "208f-419e-308dc99"<br>If-Range &nbsp;指定资源的一个实体标记，客户端已经拥有此资源的一个拷贝。必须与Range头标一同使用。<br>&nbsp;&nbsp;如果此实体自上次被客户端检索以来，还不曾修改过，那么服务器只发送指定的范围，否则它将发送整个资源。<br>&nbsp;&nbsp;例如：Range: byte=0-499&lt;CRLF&gt;If-Range:"208f-419e-30f8dc99"<br>If-Unmodified-Since 只有自指定的日期以来，被请求的实体还不曾被修改过，才会返回此实体。<br>&nbsp;&nbsp;例如：If-Unmodified-Since:Mon,10PR 18:42:51 GMT<br>Last-Modified &nbsp;指定被请求资源上次被修改的日期和时间。例如：Last-Modified: Mon,10PR 18:42:51 GMT<br>Location &nbsp;对于一个已经移动的资源，用于重定向请求者至另一个位置。<br>&nbsp;&nbsp;与状态编码302（暂时移动）或者301（永久性移动）配合使用。<br>&nbsp;&nbsp;例如：Location: <a href="http://www2.myweb.com/index.jsp">http://www2.myweb.com/index.jsp</a><br>Max-Forwards &nbsp;一个用于TRACE方法的请求头标，以指定代理或网关的最大数目，该请求通过网关才得以路由。<br>&nbsp;&nbsp;在通过请求传递之前，代理或网关应该减少此数目。例如：Max-Forwards: 3<br>Pragma &nbsp;&nbsp;一个通用头标，它发送实现相关的信息。例如：Pragma: no-cache<br>Proxy-Authenticate 类似于WWW-Authenticate，便是有意请求只来自请求链（代理）的下一个服务器的认证。<br>&nbsp;&nbsp;例如：Proxy-Authenticate: Basic realm-admin<br>Proxy-Proxy-Authorization 类似于授权，但并非有意传递任何比在即时服务器链中更进一步的内容。<br>&nbsp;&nbsp;例如：Proxy-Proxy-Authorization: Basic YXV0aG9yOnBoaWw=<br>Public &nbsp;&nbsp;列表显示服务器所支持的方法集。例如：Public: OPTIONS,MGET,MHEAD,GET,HEAD<br>Range &nbsp;&nbsp;指定一种度量单位和一个部分被请求资源的偏移范围。例如：Range: bytes=206-5513<br>Refener &nbsp;一种请求头标域，标明产生请求的初始资源。对于HTML表单，它包含此表单的Web页面的地址。<br>&nbsp;&nbsp;例如：Refener: <a href="http://www.myweb.com/news/search.html">http://www.myweb.com/news/search.html</a><br>Retry-After &nbsp;一种响应头标域，由服务器与状态编码503（无法提供服务）配合发送，以标明再次请求之前应该等待多长时间。<br>&nbsp;&nbsp;此时间即可以是一种日期，也可以是一种秒单位。例如：Retry-After: 18<br>Server &nbsp;&nbsp;一种标明Web服务器软件及其版本号的头标。例如：Server: Apache/2.0.46(Win32)<br>Transfer-Encoding 一种通用头标，标明对应被接受方反向的消息体实施变换的类型。例如：Transfer-Encoding: chunked<br>Upgrade &nbsp;允许服务器指定一种新的协议或者新的协议版本，与响应编码101（切换协议）配合使用。<br>&nbsp;&nbsp;例如：Upgrade: HTTP/2.0<br>User-Agent &nbsp;定义用于产生请求的软件类型（典型的如Web浏览器）。<br>&nbsp;&nbsp;例如：User-Agent: Mozilla/4.0(compatible; MSIE 5.5; Windows NT; DigExt)<br>Vary &nbsp;&nbsp;一个响应头标，用于表示使用服务器驱动的协商从可用的响应表示中选择响应实体。例如：Vary: *<br>Via &nbsp;&nbsp;一个包含所有中间主机和协议的通用头标，用于满足请求。例如：Via: 1.0 fred.com, 1.1 wilma.com<br>Warning &nbsp;用于提供关于响应状态补充信息的响应头标。例如：Warning: 99 <a href="http://www.myweb.com/">www.myweb.com</a> Piano needs tuning<br>www-Authenticate 一个提示用户代理提供用户名和口令的响应头标，与状态编码401（未授权）配合使用。响应一个授权头标。<br>&nbsp;&nbsp;例如：www-Authenticate: Basic realm=zxm.mgmt</p>
<p>= HTTP码应码<br>响应码由三位十进制数字组成，它们出现在由HTTP服务器发送的响应的第一行, 分五种类型，由它们的第一位数字表示：<br>- 1xx：信息，请求收到，继续处理<br>- 2xx：成功，行为被成功地接受、理解和采纳<br>- 3xx：重定向，为了完成请求，必须进一步执行的动作<br>- 4xx：客户端错误，请求包含语法错误或者请求无法实现<br>- 5xx：服务器错误，服务器不能实现一种明显无效的请求</p>
<p>下表显示每个响应码及其含义：<br>100 继续<br>101 分组交换协<br>200 OK<br>201 被创建<br>202 被采纳<br>203 非授权信息<br>204 无内容<br>205 重置内容<br>206 部分内容<br>300 多选项<br>301 永久地传送<br>302 找到<br>303 参见其他<br>304 未改动<br>305 使用代理<br>307 暂时重定向<br>400 错误请求<br>401 未授权<br>402 要求付费<br>403 禁止<br>404 未找到<br>405 不允许的方法<br>406 不被采纳<br>407 要求代理授权<br>408 请求超时<br>409 冲突<br>410 过期的<br>411 要求的长度<br>412 前提不成立<br>413 请求实例太大<br>414 请求URI太大<br>415 不支持的媒体类型<br>416 无法满足的请求范围<br>417 失败的预期<br>500 内部服务器错误<br>501 未被使用<br>502 网关错误<br>503 不可用的服务<br>504 网关超时<br>505 HTTP版本未被支持 </p>
<p><br>= 实例 </p>
<p>== POST 数据</p>
<p>== 上传一个文件 <br>假设接受文件的网页程序位于 <a href="http://192.168.29.65/upload_file/UploadFile">http://192.168.29.65/upload_file/UploadFile</a>.假设我们要发送一个二进制文件、一个文本框表单项、一个密码框表单项。文件名为 "1.txt" ，其内容如下：（其中的XXX代表二进制数据，如 01 02 03） <br>a<br>bb <br>ccc </p>
<p>客户端链接 192.168.29.65 后, 应该发送如下http 请求：<br>POST /upload_file/UploadFile HTTP/1.1 <br>Accept: text/plain, */* <br>Accept-Language: zh-cn <br>Host: 192.168.29.65<br>Content-Type:multipart/form-data;boundary=---------------------------7d33a816d302b6 <br>User-Agent: Mozilla/4.0 (compatible; OpenOffice.org) <br>Content-Length: 333<br>Connection: Keep-Alive </p>
<p style="COLOR: red">-----------------------------7d33a816d302b6 <br>Content-Disposition: form-data; name="userfile1"; filename="E:s" <br>Content-Type: application/octet-stream <br>a <br>bb <br>ccc <br>-----------------------------7d33a816d302b6 <br>Content-Disposition: form-data; name="text1" <br>foo <br>-----------------------------7d33a816d302b6 <br>Content-Disposition: form-data; name="password1" <br>bar <br>-----------------------------7d33a816d302b6-- </p>
<p><span style="COLOR: red">(上面有一个回车)</span> </p>
<p>此内容必须一字不差，包括最后的回车。 <br>注意：Content-Length: 333 这里的333是红色内容的总长度（包括最后的回车） <br>注意这一行： <br>Content-Type: multipart/form-data; boundary=---------------------------7d33a816d302b6 <br>根据 rfc1867, multipart/form-data是必须的. <br>---------------------------7d33a816d302b6 是分隔符，分隔多个文件、表单项。其中33a816d302b6 是即时生成的一个数字，用以确保整个分隔符不会在文件或表单项的内容中出现。<strong>Form每个部分用分隔符分割，分隔符之前必须加上"--"着两个字符(即--{boundary})才能被http协议认为是Form的分隔符，表示结束的话用在正确的分隔符后面添加"--"表示结束。</strong> </p>
<p>前面的 ---------------------------7d 是 IE 特有的标志,Mozila 为---------------------------71. <br>每个分隔的数据的都可以用Content-Type来表示下面数据的类型，可以参考rfc1341 (<a href="http://www.ietf.org/rfc/rfc1341.txt">http://www.ietf.org/rfc/rfc1341.txt</a>) 例如： <br>Contect-Type:application/octet-stream 表示下面的数据是二进制数据 <br>Contect-Type:text/plain 表示下面的数据是ASSCII码数据 <br>Contect-Type:text/richtext 表示下面的数据是RTF格式 </p>
<img src ="http://www.cppblog.com/bigsml/aggbug/62754.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/bigsml/" target="_blank">泡泡牛</a> 2008-09-25 14:05 <a href="http://www.cppblog.com/bigsml/archive/2008/09/25/62754.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Apache 安装在只读分区上的配置</title><link>http://www.cppblog.com/bigsml/archive/2008/07/18/56522.html</link><dc:creator>泡泡牛</dc:creator><author>泡泡牛</author><pubDate>Fri, 18 Jul 2008 10:08:00 GMT</pubDate><guid>http://www.cppblog.com/bigsml/archive/2008/07/18/56522.html</guid><wfw:comment>http://www.cppblog.com/bigsml/comments/56522.html</wfw:comment><comments>http://www.cppblog.com/bigsml/archive/2008/07/18/56522.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/bigsml/comments/commentRss/56522.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/bigsml/services/trackbacks/56522.html</trackback:ping><description><![CDATA[<p>有时候Apache 程序安装在NFS ,SAMBA, Windows 的共享盘上, 而且可能是只读, 所以需要修改一些配置. 主要有: <br>#&nbsp;apache 运行时所依赖文件<br>LockFile /path/to/apache-rproxy.lock <br>#&nbsp;apache 运行时会修改的相关文件<br>PidFile /path/to/apache-rproxy.pid <br>ErrorLog /path/to/apache-rproxy.elog <br>CustomLog /path/to/apache-rproxy.dlog "%{%v/%T}t %h -&gt; %{SERVER}e URL: %U" <br><br>具体说明如下 <br><br>ServerRoot "/usr/local" <br>ServerRoot用于指定守护进程httpd的运行目录，httpd在启动之后将自动将进程的当前目录改变为这个目录，因此如果设置文件中指定的文件或目录是相对路径，那么真实路径就位于这个ServerRoot定义的路径之下。</p>
<p>由于httpd会经常进行并发的文件操作，就需要使用加锁的方式来保证文件操作不冲突，由于NFS文件系统在文件加锁方面能力有限，因此这个目录应该是本地磁盘文件系统，而不应该使用NFS文件系统。 </p>
<p>LockFile /var/run/httpd.lock<br>LockFile参数指定了httpd守护进程的加锁文件，一般不需要设置这个参数，Apache服务器将自动在ServerRoot下面的路径中进行操作。但如果ServerRoot为NFS文件系统，便需要使用这个参数指定本地文件系统中的路径。 <br><br>PidFile /var/run/httpd.pid <br>PidFile指定的文件将记录httpd守护进程的进程号，由于httpd能自动复制其自身，因此系统中有多个httpd进程，但只有一个进程为最初启动的进程，它为其他进程的父进程，对这个进程发送信号将影响所有的httpd进程。PidFILE定义的文件中就记录httpd父进程的进程号。 </p>
<img src ="http://www.cppblog.com/bigsml/aggbug/56522.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/bigsml/" target="_blank">泡泡牛</a> 2008-07-18 18:08 <a href="http://www.cppblog.com/bigsml/archive/2008/07/18/56522.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>