<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>xilo&#039;s blog &#187; lastModifed</title>
	<atom:link href="http://www.xilo.cn/blog/tag/lastmodifed/feed" rel="self" type="application/rss+xml" />
	<link>http://www.xilo.cn/blog</link>
	<description>Every day,every hour,and every minute is special！</description>
	<lastBuildDate>Tue, 27 Sep 2011 06:19:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
		<item>
		<title>获取文件自身更新时间</title>
		<link>http://www.xilo.cn/blog/2009/09/09/281</link>
		<comments>http://www.xilo.cn/blog/2009/09/09/281#comments</comments>
		<pubDate>Wed, 09 Sep 2009 00:58:47 +0000</pubDate>
		<dc:creator>xilo</dc:creator>
				<category><![CDATA[开发]]></category>
		<category><![CDATA[lastModifed]]></category>

		<guid isPermaLink="false">http://www.xilo.cn/blog/?p=281</guid>
		<description><![CDATA[需求需要 自动获取文件自身的更新时间。本想js就有函数lastModified就能实现，直接write document.lastModifed就可以了，本地测试OK，可上传至服务器就出现 时间随即时时间变化。上网查了下。 有这... ]]></description>
			<content:encoded><![CDATA[<p>需求需要 自动获取文件自身的更新时间。本想js就有函数lastModified就能实现，直接write document.lastModifed就可以了，本地测试OK，可上传至服务器就出现 时间随即时时间变化。上网查了下。</p>
<p>有这么段：</p>
<blockquote><p>在http中Last-Modified 与If-Modified-Since 都是用于记录页面最后修改时间的 HTTP 头信息，注意,在这 Last-Modified 是由服务器往客户端发送的 HTTP 头，另一个 If-Modified-Since是由客户端往服务器发送的头，可以看到，再次请求本地存在的 cache 页面时，客户端会通过 If-Modified-Since 头将先前服务器端发过来的 Last-Modified 最后修改时间戳发送回去，这是为了让服务器端进行验证，通过这个时间戳判断客户端的页面是否是最新的，如果不是最新的，则返回新的内容，如果是最新的，则 返回 304 告诉客户端其本地 cache 的页面是最新的，于是客户端就可以直接从本地加载页面了，这样在网络上传输的数据就会大大减少，同时也减轻了服务器的负担。</p></blockquote>
<p>看来要采取别的方法了，再说不能禁止apache的Last-Modified呀。</p>
<p>找了找PHP函数，果真有（PHP太方便了！）</p>
<p>函数 filemtime(“文件名称”)就可以获取到了，所以直接替换成&lt;?=date(&#8220;Y-m-d H:i:s&#8221;,filemtime(__FILE__));?&gt;就OK了。（__FILE__是获取文件名称，filectime为获取文件创建时间。）</p>]]></content:encoded>
			<wfw:commentRss>http://www.xilo.cn/blog/2009/09/09/281/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

