<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title><![CDATA[思想之地]]></title> 
<description><![CDATA[做好技术不是不停的追赶最新的东西，而是用精手头的东西]]></description>
<link>http://be-evil.org</link>
<language>zh-cn</language>
<generator>www.emlog.net</generator>

<item>
	<title>Google使用高手进阶</title>
	<link>http://be-evil.org/?post=156</link>
	<description><![CDATA[<p>
	本文转载自：<a href="http://lzhi.info/views/377">http://lzhi.info/views/377</a></p>
<p>
	大前提：英文Google&rarr;www.google.com</p>
<p>
	第一篇</p>
<p>
	在搜索框上输入：&ldquo;indexof/&rdquo;inurl:lib</p>
<p>
	再按搜索你将进入许多图书馆，并且一定能下载自己喜欢的书籍。</p>
<p>
	在搜索框上输入：&ldquo;indexof/&rdquo;cnki</p>
<p>
	再按搜索你就可以找到许多图书馆的CNKI、VIP、超星等入口！</p>
<p>
	在搜索框上输入：&ldquo;indexof/&rdquo;ppt</p>
<p>
	再按搜索你就可以突破网站入口下载powerpint作品！</p>
<p>
	在搜索框上输入：&ldquo;indexof/&rdquo;mp3</p>
<p>
	再按搜索你就可以突破网站入口下载mp3、rm等影视作品！</p>
<p>
	在搜索框上输入：&ldquo;indexof/&rdquo;swf</p>
<p>
	再按搜索你就可以突破网站入口下载flash作品！</p>
<p>
	在搜索框上输入：&ldquo;indexof/&rdquo;要下载的软件名</p>
<p>
	再按搜索你就可以突破网站入口下载软件！</p>
<p>
	注意引号应是英文的！</p>
<p>
	再透露一下，如果你输入：</p>
<p>
	&ldquo;indexof/&rdquo;AVI</p>
<p>
	另补上第二篇</p>
<p>
	用GOOgle看世界!!!只要你在GOOGLE里输入特殊的关键字,就可以搜到数千个摄象头的IP地址!通过他你就可以看到其所摄的实时影象!!</p>
<p>
	在google里输入</p>
<p>
	inurl:&rdquo;viewerframe?mode=&rdquo;</p>
<p>
	随便打开一个,然后按提示装一个插件,就可以看到了!!!</p>
<p>
	再补上第三篇</p>
<p>
	三则黑客的Google搜索技巧简介</p>
<p>
	大家都知道，Google毫无疑问是当今世界上最强大的搜索引擎。然而，在黑客手中，它也是一个秘密武器，它能搜索到一些你意想不到的信息。赛迪编 者把 他们进行了简单的总结不是希望您利用他去攻击别人的网站，而是利用这些技巧去在浩如烟海的网络信息中，来个大海捞针，寻找到对您有用的信息。</p>
<p>
	如果您是一名普通网民，您可以使用黑客的技巧扩大自己的视野，提高自己的检索效率；如果您是一名网管，请您赶快看看您的网站是否做好了对下面黑客探 测手 段的防范措施，如果没有就赶快来个亡羊补牢，毕竟隐患胜于明火，防范胜于救灾；如果您是一名黑客，相信您早以在别的黑客站点上见过类似的方法，这篇文章对 您没什么用处，这里的技巧对您是小儿科，菜鸟级！您可以节省宝贵的时间做更有意义的事情，这篇文章您不用看了，到别处去吧！</p>
<p>
	基于上面的考虑我编发了这篇文章。</p>
<p>
	搜索URL</p>
<p>
	比如我们提交这种形式：passwd.txtsite:virtualave.net</p>
<p>
	看到了什么？是不是觉得太不可思议了！有很多基于CGI/PHP/ASP类型的留言板存在这种问题。有时我们得到密码甚至还是明码的！管理员或许太 不负 责了，或许安全防范的意识太差了，如果你是网络管理员，赶快检查一下不要让恶意攻击者捡了便宜。不要太相信DES加密，即使我们的密码经过DES加密的密 码，黑客们还是可以通过许多破解软件来搞定。</p>
<p>
	这次我们能得到包含密码的文件。&ldquo;site:virtualave.net&rdquo;意思是只搜索virutalave.net的URL。 virutalave.net是一个网络服务器提供商。</p>
<p>
	同样，我们可以搜索一些顶级域名，比如：.net.org.jp.in.gr</p>
<p>
	config.txtsite:.jp</p>
<p>
	admin.txtsite:.tw</p>
<p>
	搜索首页的目录</p>
<p>
	首页是非常有用的，它会提供给你许多有用的信息。</p>
<p>
	我们提交如下的形式：</p>
<p>
	&ldquo;Indexof/admin&rdquo;</p>
<p>
	&ldquo;Indexof/secret&rdquo;</p>
<p>
	&ldquo;Indexof/cgi-bin&rdquo;site:.edu</p>
<p>
	你可以自己定义搜索的首页字符。这样就可以获得许多信息。</p>
<p>
	搜索特定的文件类型</p>
<p>
	比如你想指定一种文件的类型，可以提交如下形式：</p>
<p>
	filetype:.docsite:.milclassified</p>
<p>
	这个就是搜索军方的资料，你可以自定义搜索。</p>
<p>
	再提供一个第四篇</p>
<p>
	Google的特殊功能</p>
<p>
	1、查询电话号码</p>
<p>
	Google的搜索栏中最新加入了电话号码和美国街区地址的查询信息。</p>
<p>
	个人如想查找这些列表，只要填写姓名，城市和省份。</p>
<p>
	如果该信息为众人所知，你就会在搜索结果页面的最上方看到搜索的电话和街区地址</p>
<p>
	你还可以通过以下任何一种方法找到该列表：</p>
<p>
	名字（或首位大写字母），姓，电话地区号</p>
<p>
	名字（或首位大写字母），姓，邮递区号</p>
<p>
	名字（或首位大写字母），姓，城市（可写州）</p>
<p>
	名字（或首位大写字母），姓，州</p>
<p>
	电话号码，包括区号</p>
<p>
	名字，城市，州</p>
<p>
	名字，邮递区号</p>
<p>
	2、查找PDF文件</p>
<p>
	现在GOOGLE的搜索结果中包括了PDF文件。尽管PDF文件不如HTML文件那么多，但他们经常具备一些其他文件不具备的高质量信息</p>
<p>
	为了显示一个搜索结果是PDF文件而不是网页，PDF文件的标题开头显示蓝色文本。</p>
<p>
	这就是让你知道ACRTOBATREADER程序会启动来阅读文件</p>
<p>
	如果你的计算机没装有该程序，计算机会指导你去能免费下载该程序的网页。</p>
<p>
	使用PDF文件时，相关的网页快照会由&ldquo;TEXTVERSION&rdquo;代替，它是PDF文档的复制文件，该文件除去了所有格式化命令。</p>
<p>
	如果你在没有PDF链接的情况下想看一系列搜索结果，只要在搜索栏中打上-inurldf加上你的搜索条件。</p>
<p>
	3、股票报价</p>
<p>
	用Google查找股票和共有基金信息，只要输入一个或多个NYSE，NASDAQ，AMEX或</p>
<p>
	共有基金的股票行情自动收录机的代码，也可以输入在股市开户的公司名字。</p>
<p>
	如果Google识别出你查询的是股票或者共有基金，它回复的链接会直接连到高质量的金融信息提供者提供的股票和共有基金信息。</p>
<p>
	在你搜索结果的开头显示的是你查询的股市行情自动收录器的代码。如果你要查找一家公司的名字（比如，INTEL），请查看&ldquo;股票报价&rdquo;在 Google搜索结果的金融栏里会有那个公司的主页的链接（比如， www. INTEL. COM）。</p>
<p>
	Google是以质量为基础来选择和决定金融信息提供者的，包括的因素有下载速度，用户界面及其功能。</p>
<p>
	4、找找谁和你链接</p>
<p>
	有些单词如果带有冒号就会有特殊的意思。比如link：操作员。查询link:siteURL，就会显示所有指向那个URL的网页。举例来说，链接 www. Google. com会向你显示所有指向GOOGLE主页的网页。但这种方法不能与关键字查询联合使用。</p>
<p>
	5、查找站点</p>
<p>
	单词site后面如果接上冒号就能够将你的搜索限定到某个网站。具体做法是：在c搜索栏中使用site:sampledomain.com这个语法 结构。比如，在斯坦福找申请信息，输入：</p>
<p>
	admissionsite: www. stanford. edu</p>
<p>
	6、查找字典释意</p>
<p>
	查找字典释意的方法是在搜索栏中输入你要查询的内容。在我们根据要求找到所有的字典释意都会标有下划线，位于搜索结果的上面，点击链接你会找到字典 提供者根据要求给出的相关定义。7、用GOOLGE查找地图</p>
<p>
	想用Google查找街区地图，在Google搜索栏中输入美国街区地址，包括邮递区号或城市/州（比如165大学大街PALOALTOCA）。通 常情况下，街区地址和城市的名字就足够了。</p>
<p>
	当Google识别你的要求是查找地图，它会反馈给你有高质量地图提供者提供的链接，使你直接找到相关地图。我们是以质量为基础选择这些地图提供 者。值得注意的是Google和使用的地图信息提供者没有任何关联。</p><div id="related_log" style="font-size:12px"><p><b>相关日志：</b></p><p><a href="http://be-evil.org/?post=134">去掉Firefox搜索google时结果里的点击跟踪链接</a></p></div>]]></description>
	<pubDate>Tue, 09 Mar 2010 16:17:40 +0800</pubDate>
	<author>朦朧中的罪惡</author>
	<guid>http://be-evil.org/?post=156</guid>

</item>
<item>
	<title>Firefox主题NAVER</title>
	<link>http://be-evil.org/?post=155</link>
	<description><![CDATA[<p>
	Firefox的皮肤NAVER，来自著名韩国著名搜索网站NAVER的日本分站，这是一款很清新的皮肤，网页Tab的浅绿色看着非常的舒服,喜欢的朋友不妨尝试一下！</p>
<p>
	<a href="http://be-evil.org/content/uploadfile/201003/2b80b9d1f4cd4efe4c57561f018a5d9420100303195411.png" id="ematt:179" target="_blank"><img alt="点击查看原图" border="0" src="http://be-evil.org/content/uploadfile/201003/2b80b9d1f4cd4efe4c57561f018a5d9420100303195411.png" /></a></p>
<p>
	NAVER安装地址</p>
<p>
	<a href="https://addons.mozilla.org/en-US/firefox/addon/13232" target="_blank">https://addons.mozilla.org/en-US/firefox/addon/13232<br />
	</a></p><div id="related_log" style="font-size:12px"><p><b>相关日志：</b></p><p><a href="http://be-evil.org/?post=107">我正在使用的FireFox扩展</a></p><p><a href="http://be-evil.org/?post=134">去掉Firefox搜索google时结果里的点击跟踪链接</a></p><p><a href="http://be-evil.org/?post=128">Firefox4主题Strata</a></p><p><a href="http://be-evil.org/?post=103">我的Firefox配置设置</a></p><p><a href="http://be-evil.org/?post=135">Firefox3.6主题Fx4</a></p><p><a href="http://be-evil.org/?post=141">Firefox主题Chromifox Extreme,将你的Firefox变成Google Chrome的外观</a></p><p><a href="http://be-evil.org/?post=139">Firefox主题Fox world</a></p><p><a href="http://be-evil.org/?post=76">超酷Firefox扩展better Gmail 2</a></p><p><a href="http://be-evil.org/?post=101">FireFox和IE下使用ajax的一些小问题总结</a></p></div>]]></description>
	<pubDate>Wed, 03 Mar 2010 19:53:17 +0800</pubDate>
	<author>朦朧中的罪惡</author>
	<guid>http://be-evil.org/?post=155</guid>

</item>
<item>
	<title>JavaScript在不同浏览器下取得鼠标绝对位置函数</title>
	<link>http://be-evil.org/?post=154</link>
	<description><![CDATA[<p>
	首先不同浏览器中event位置属性的分析:</p>
<p>
	1. IE的event.x,event.y是以事件触发元素的父元素外界为参考点(不包括滚动距离)<br />
	2. Firefox的event.pageX,event.pageY是以body元素为参考点(包括滚动距离)<br />
	3. event.clientX,event.clientY以浏览器左上角为参考点(不包括滚动距离)<br />
	4. IE的event.offsetX,event.offsetY和Firefox的event.layerX,event.layerY以事件触发元素内界的左上角为参考点(包括滚动距离,当有边框时,可能出现负数)</p>
<p>
	然后是DOM对象高度属性分析<br />
	<br />
	1. scrollHeight: 获取对象的滚动高度<br />
	2. scrollLeft:设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离 <br />
	3. scrollTop:设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离 <br />
	4. scrollWidth:获取对象的滚动宽度 <br />
	5. offsetHeight:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度 <br />
	6. offsetLeft:获取对象相对于版面或由 offsetParent 属性指定的父坐标的计算左侧位置 <br />
	7. offsetTop:获取对象相对于版面或由 offsetTop 属性指定的父坐标的计算顶端位置</p>
<p>
	有了以上分析，写出两个取位置的函数</p>
<p>
	<span style="color: rgb(0, 128, 0);">// 取X轴位置</span><br />
	<span style="color: rgb(0, 0, 255);">function</span> <span style="color: rgb(0, 0, 0);">mouseX</span>(<span style="color: rgb(0, 0, 0);">evt</span>) <span style="color: rgb(0, 0, 0);">{</span><br />
	&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 128, 0);">// firefox</span><br />
	&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 0, 255);">if</span> (<span style="color: rgb(0, 0, 0);">evt</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">pageX</span>) <span style="color: rgb(0, 0, 255);">return</span> <span style="color: rgb(0, 0, 0);">evt</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">pageX</span>;<br />
	&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 128, 0);">// IE</span><br />
	&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 0, 255);">else</span> <span style="color: rgb(0, 0, 255);">if</span> (<span style="color: rgb(0, 0, 0);">evt</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">clientX</span>)<br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 0, 255);">return</span> <span style="color: rgb(0, 0, 0);">evt</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">clientX</span> <span style="color: rgb(0, 0, 0);">+</span> (<span style="color: rgb(0, 0, 0);">document</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">documentElement</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">scrollLeft</span> <span style="color: rgb(0, 0, 0);">?</span> <span style="color: rgb(0, 0, 0);">document</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">documentElement</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">scrollLeft</span> <span style="color: rgb(0, 0, 0);">:</span> <span style="color: rgb(0, 0, 0);">document</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">body</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">scrollLeft</span>);<br />
	&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 0, 255);">else</span> <span style="color: rgb(0, 0, 255);">return</span> <span style="color: rgb(0, 0, 255);">null</span>;<br />
	<span style="color: rgb(0, 0, 0);">}</span><br />
	<span style="color: rgb(0, 128, 0);">// 取Y轴位置</span><br />
	<span style="color: rgb(0, 0, 255);">function</span> <span style="color: rgb(0, 0, 0);">mouseY</span>(<span style="color: rgb(0, 0, 0);">evt</span>) <span style="color: rgb(0, 0, 0);">{</span><br />
	&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 128, 0);">// firefox</span><br />
	&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 0, 255);">if</span> (<span style="color: rgb(0, 0, 0);">evt</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">pageY</span>) <span style="color: rgb(0, 0, 255);">return</span> <span style="color: rgb(0, 0, 0);">evt</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">pageY</span>;<br />
	&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 128, 0);">// IE</span><br />
	&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 0, 255);">else</span> <span style="color: rgb(0, 0, 255);">if</span> (<span style="color: rgb(0, 0, 0);">evt</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">clientY</span>)<br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 0, 255);">return</span> <span style="color: rgb(0, 0, 0);">evt</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">clientY</span> <span style="color: rgb(0, 0, 0);">+</span> (<span style="color: rgb(0, 0, 0);">document</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">documentElement</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">scrollTop</span> <span style="color: rgb(0, 0, 0);">?</span> <span style="color: rgb(0, 0, 0);">document</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">documentElement</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">scrollTop</span> <span style="color: rgb(0, 0, 0);">:</span> <span style="color: rgb(0, 0, 0);">document</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">body</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">scrollTop</span>);<br />
	&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 0, 255);">else</span> <span style="color: rgb(0, 0, 255);">return</span> <span style="color: rgb(0, 0, 255);">null</span>;<br />
	<span style="color: rgb(0, 0, 0);">}</span></p><div id="related_log" style="font-size:12px"><p><b>相关日志：</b></p><p><a href="http://be-evil.org/?post=31">JavaScript在IE下设置innerHTML时出现&quot;未知的运行时错误&quot;</a></p><p><a href="http://be-evil.org/?post=116">jquery修复ie6不支持position: fixed;的插件</a></p><p><a href="http://be-evil.org/?post=33">JavaScript得到当前窗口的所有大小值</a></p><p><a href="http://be-evil.org/?post=52">IE6和IE7中document.getElementsByName用法问题</a></p><p><a href="http://be-evil.org/?post=92">ie6下不运行gzip压缩后javascript代码的Bug</a></p><p><a href="http://be-evil.org/?post=86">IE的document.getElementById混淆name和id属性的BUG</a></p><p><a href="http://be-evil.org/?post=61">在线正则表达式测试工具Regex Tester</a></p><p><a href="http://be-evil.org/?post=66">Discuz!编辑器附件添加原理不完全研究</a></p><p><a href="http://be-evil.org/?post=83">IE中使用JavaScript中调用form.submit()提示“对象不支持此属性和方法”问题研究</a></p><p><a href="http://be-evil.org/?post=101">FireFox和IE下使用ajax的一些小问题总结</a></p></div>]]></description>
	<pubDate>Wed, 03 Mar 2010 14:32:36 +0800</pubDate>
	<author>朦朧中的罪惡</author>
	<guid>http://be-evil.org/?post=154</guid>

</item>
<item>
	<title>PHP使用empty检查函数返回结果时报Fatal error: Can't use function return value in write context的问题</title>
	<link>http://be-evil.org/?post=153</link>
	<description><![CDATA[<p>
	PHP开发时，当你使用empty检查一个函数返回的结果时会报错：Fatal error: Can&#39;t use function return value in write context</p>
<p>
	例如:</p>
<p>
	&lt;?php<br />
	<span style="color: rgb(0, 0, 255);">echo</span> <span style="color: rgb(255, 0, 0);">empty</span>(<span style="color: rgb(255, 0, 0);">strlen</span>(<span style="color: rgb(0, 128, 0);">&#39;be-evil.org&#39;</span>));</p>
<p>
	到PHP手册里面查看，在empty函数描述的地方有以下文字:</p>
<p>
	<b class="note">Note</b>: <b>empty()</b> only checks variables as anything else will result in a parse error. In other words, the following will not work: <strong class="command">empty(trim($name))</strong>.</p>
<p>
	<b>empty()</b> 只检测变量，检测任何非变量的东西都将导致解析错误!</p>
<p>
	因此，我们不能拿empty来直接检测函数返回的值，上面例子的解决方案如下：</p>
<p>
	&lt;?php</p>
<p>
	$length = <span style="color: rgb(255, 0, 0);">strlen</span>(<span style="color: rgb(0, 128, 0);">&#39;be-evil.org&#39;</span>);</p>
<p>
	<span style="color: rgb(0, 0, 255);">echo</span> <span style="color: rgb(255, 0, 0);">empty</span>($length);</p>
<p>
	&nbsp;</p><div id="related_log" style="font-size:12px"><p><b>相关日志：</b></p><p><a href="http://be-evil.org/?post=95">phpCodeBeautifier批量php程序代码美化工具</a></p><p><a href="http://be-evil.org/?post=66">Discuz!编辑器附件添加原理不完全研究</a></p><p><a href="http://be-evil.org/?post=8">[原创]做了几道国外公司出的PHP考试题</a></p><p><a href="http://be-evil.org/?post=104">Windows下自定义php.ini的位置</a></p><p><a href="http://be-evil.org/?post=70">Eclipse+php插件+Xdebug搭建PHP完美开发/调试环境指南</a></p><p><a href="http://be-evil.org/?post=150">Windows7下使用IIS7与FastCGI模块配置PHP5.3.1运行环境图文记录</a></p><p><a href="http://be-evil.org/?post=114">php仿银行电子口令卡生成程序</a></p><p><a href="http://be-evil.org/?post=140">php函数unserialize数据返回false问题分析</a></p><p><a href="http://be-evil.org/?post=109">PHP实现各种排序算法</a></p><p><a href="http://be-evil.org/?post=102">PHP浮点数比较不准的解决方法</a></p></div>]]></description>
	<pubDate>Tue, 02 Mar 2010 17:18:11 +0800</pubDate>
	<author>朦朧中的罪惡</author>
	<guid>http://be-evil.org/?post=153</guid>

</item>
<item>
	<title>如何下载Google Chrome离线安装版本？</title>
	<link>http://be-evil.org/?post=152</link>
	<description><![CDATA[<p>
	Google Chrome默认是在线安装的，如果网速不好，那么安装的速度是相当的慢，如何解决这个问题呢？</p>
<p>
	当然是下载离线完整安装包，地址为：</p>
<p>
	<a href="http://www.google.com/chrome/eula.html?standalone=1" target="_blank"><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: arial, 'san serif'; font-size: 13px; border-collapse: collapse; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; ">http://www.google.com/chrome/eula.html?standalone=1</span></a></p>]]></description>
	<pubDate>Mon, 01 Mar 2010 18:57:22 +0800</pubDate>
	<author>朦朧中的罪惡</author>
	<guid>http://be-evil.org/?post=152</guid>

</item>
<item>
	<title>PHP函数strtotime理解笔记</title>
	<link>http://be-evil.org/?post=151</link>
	<description><![CDATA[<p>
	官方手册里面对strtotime的描述：</p>
<p>
	strtotime() 函数将任何英文文本的日期时间描述解析为 Unix 时间戳。</p>
<p>
	那么意味着这个函数可以把2010-02-28 18:31:33转换为1267353093这种格式</p>
<p>
	但是使用它转换时间戳的时候要注意的是服务器的date.timezone的配置,在函数说明中有这么一段话</p>
<p>
	该函数将使用 TZ 环境变量（如果有的话）来计算时间戳。自 PHP 5.1.0 起有更容易的方法来定义时区用于所有的日期／时间函数。此过程在 date_default_timezone_get()&nbsp; 函数页面中有说明。</p>
<p>
	上面的话可以这么理解:</p>
<p>
	如果date.timezone配置为空或者为UTC（格林威治时间），那么它就会直接把传入的时间直接转换为该时间的UNIX时间戳(相当于该时间识别为格林威治时间)</p>
<p>
	如果date.timezone配置了时区，例如Asia/Shanghai,那么这个函数就会将传入的时间认为是<strong>配置的时区的当地时间</strong>，然后根据该时区与UTC(格林威治时间)的时差来算格林威治时间的时间戳。</p>
<p>
	例如：</p>
<p>
	php.ini配置date.timezone为Asia/Shanghai;</p>
<p>
	我们传入：2010-02-28 18:31:33</p>
<p>
	函数转出的时间戳的实际时间为:</p>
<p>
	2010-02-28 10:31:33</p>
<p>
	因为Asia/Shanghai位于 +8区，那么函数会自动减去了8个钟头的时间来得到格林威治时间</p>
<p>
	参考程序测试代码：</p>
<p>
	<span style="color: rgb(0, 0, 255);">&lt;?php</span><br />
	<span style="color: rgb(0, 0, 255);">echo</span> <span style="color: rgb(163, 21, 21);">&#39;2010-02-28 00:00:00&#39;</span>;<br />
	<span style="color: rgb(0, 0, 255);">echo</span> <span style="color: rgb(163, 21, 21);">&#39;&lt;br&gt;&#39;</span>;<br />
	<span style="color: rgb(0, 128, 0);">// 格林威治时间 0</span><br />
	<span style="color: rgb(0, 0, 0);">date_default_timezone_set</span>(<span style="color: rgb(163, 21, 21);">&#39;UTC&#39;</span>);<br />
	<span style="color: rgb(0, 0, 255);">echo</span> <span style="color: rgb(0, 0, 0);">gmdate</span>(<span style="color: rgb(163, 21, 21);">&#39;Y-m-d H:i:s&#39;</span><span style="color: rgb(0, 0, 0);">,</span> <span style="color: rgb(0, 0, 0);">strtotime</span>(<span style="color: rgb(163, 21, 21);">&#39;2010-02-28 00:00:00&#39;</span>));<br />
	<span style="color: rgb(0, 0, 255);">echo</span> <span style="color: rgb(163, 21, 21);">&#39;&lt;br&gt;&#39;</span>;<br />
	<span style="color: rgb(0, 128, 0);">// 中国上海时间 + 8</span><br />
	<span style="color: rgb(0, 0, 0);">date_default_timezone_set</span>(<span style="color: rgb(163, 21, 21);">&#39;Asia/Shanghai&#39;</span>);<br />
	<span style="color: rgb(0, 0, 255);">echo</span> <span style="color: rgb(0, 0, 0);">gmdate</span>(<span style="color: rgb(163, 21, 21);">&#39;Y-m-d H:i:s&#39;</span><span style="color: rgb(0, 0, 0);">,</span> <span style="color: rgb(0, 0, 0);">strtotime</span>(<span style="color: rgb(163, 21, 21);">&#39;2010-02-28 00:00:00&#39;</span>));<br />
	<span style="color: rgb(0, 0, 255);">echo</span> <span style="color: rgb(163, 21, 21);">&#39;&lt;br&gt;&#39;</span>;<br />
	<span style="color: rgb(0, 128, 0);">// 美国洛杉矶时间 - 8</span><br />
	<span style="color: rgb(0, 0, 0);">date_default_timezone_set</span>(<span style="color: rgb(163, 21, 21);">&#39;America/Los_Angeles&#39;</span>);<br />
	<span style="color: rgb(0, 0, 255);">echo</span> <span style="color: rgb(0, 0, 0);">gmdate</span>(<span style="color: rgb(163, 21, 21);">&#39;Y-m-d H:i:s&#39;</span><span style="color: rgb(0, 0, 0);">,</span> <span style="color: rgb(0, 0, 0);">strtotime</span>(<span style="color: rgb(163, 21, 21);">&#39;2010-02-28 00:00:00&#39;</span>));<br />
	<span style="color: rgb(0, 0, 255);">echo</span> <span style="color: rgb(163, 21, 21);">&#39;&lt;br&gt;&#39;</span>;</p>
<p>
	输出:</p>
<p>
	2010-02-28 00:00:00<br />
	2010-02-28 00:00:00<br />
	2010-02-27 16:00:00<br />
	2010-02-28 08:00:00</p><div id="related_log" style="font-size:12px"><p><b>相关日志：</b></p><p><a href="http://be-evil.org/?post=100">PHP函数ereg与preg的区别</a></p><p><a href="http://be-evil.org/?post=24">Linux虚拟主机空间文件或文件夹无法删除的解决办法</a></p><p><a href="http://be-evil.org/?post=114">php仿银行电子口令卡生成程序</a></p><p><a href="http://be-evil.org/?post=86">IE的document.getElementById混淆name和id属性的BUG</a></p><p><a href="http://be-evil.org/?post=102">PHP浮点数比较不准的解决方法</a></p><p><a href="http://be-evil.org/?post=46">累</a></p><p><a href="http://be-evil.org/?post=55">php引用(References)不完全研究</a></p><p><a href="http://be-evil.org/?post=112">iis7以fastcgi配置php时出现FastCGI进程意外退出问题解决</a></p><p><a href="http://be-evil.org/?post=50">将XP宋体替换为VISTA宋体的方法</a></p><p><a href="http://be-evil.org/?post=149">PHP使用Session和全局变量开启时候出现waring提示的分析</a></p></div>]]></description>
	<pubDate>Sun, 28 Feb 2010 20:39:52 +0800</pubDate>
	<author>朦朧中的罪惡</author>
	<guid>http://be-evil.org/?post=151</guid>

</item>
<item>
	<title>Windows7下使用IIS7与FastCGI模块配置PHP5.3.1运行环境图文记录</title>
	<link>http://be-evil.org/?post=150</link>
	<description><![CDATA[<p>
	PHP5.3增加了很多新特性，是时候该好好体验一下了，本文使用了FastCGI模块来配置PHP5.3运行环境，虽然然与常规的配置方式有点区别，但是步骤更加简单方便。</p>
<p>
	1.下载PHP5.3程序代码</p>
<p>
	可以去PHP官方的下载站去下载<a href="http://windows.php.net/download/" target="_blank">http://windows.php.net/download/</a></p>
<p>
	注意使用IIS7的话需要下载VC9版本（VC9 X86）</p>
<p>
	<a href="http://windows.php.net/downloads/releases/php-5.3.1-Win32-VC9-x86.zip" target="_blank">http://windows.php.net/downloads/releases/php-5.3.1-Win32-VC9-x86.zip<br />
	</a></p>
<p>
	2.解压缩代码压缩包并配置</p>
<p>
	解压缩后将文件夹中的php.ini-development修改为php.ini，然后用文本编辑器修改以下内容</p>
<p>
	extension_dir = &quot;D:\PHP程序文件目录\ext&quot;</p>
<p>
	去掉</p>
<p>
	extension=php_mysql.dll<br />
	extension=php_mysqli.dll</p>
<p>
	等扩展前面的分号注释,具体模块请根据自己的需要开启和关闭</p>
<p>
	date.timezone = &quot;Asia/Shanghai&quot;</p>
<p>
	上面这项是PHP5.3必须配置的项目，否则运行phpinfo时会出现Waring警告</p>
<p>
	CGI配置</p>
<pre class="inicode">fastcgi.impersonate = 1
fastcgi.logging = 0
cgi.fix_pathinfo = 1
cgi.force_redirect = 0</pre>
<p>
	3.安装IIS7</p>
<p>
	进入控制面板 -&nbsp; 选择&ldquo;<strong>程序</strong>&rdquo;</p>
<p>
	<a href="http://be-evil.org/content/uploadfile/201002/6e3ff27578c6cd0eba956b1730fac3a820100228170959.png" id="ematt:170" target="_blank"><img alt="点击查看原图" border="0" src="http://be-evil.org/content/uploadfile/201002/6e3ff27578c6cd0eba956b1730fac3a820100228170959.png" /></a></p>
<p>
	然后再选择 &ldquo;<strong>打开或关闭Windows功能</strong>&rdquo;</p>
<p>
	<a href="http://be-evil.org/content/uploadfile/201002/0d221bab2394d62022a1942810845ddd20100228170959.png" id="ematt:171" target="_blank"><img alt="点击查看原图" border="0" src="http://be-evil.org/content/uploadfile/201002/thum-0d221bab2394d62022a1942810845ddd20100228170959.png" /></a></p>
<p>
	选择&rdquo;<strong>万维网服务</strong>&ldquo;</p>
<p>
	<a href="http://be-evil.org/content/uploadfile/201002/2b80b9d1f4cd4efe4c57561f018a5d9420100228170959.png" id="ematt:172" target="_blank"><img alt="点击查看原图" border="0" src="http://be-evil.org/content/uploadfile/201002/2b80b9d1f4cd4efe4c57561f018a5d9420100228170959.png" /></a></p>
<p>
	注意请展开&ldquo;<strong>应用程序开发功能</strong>&rdquo;选中&ldquo;<strong>CGI</strong>&ldquo;这个选项</p>
<p>
	<a href="http://be-evil.org/content/uploadfile/201002/aa17a7df9330b4ab503d8427b591433e20100228170959.png" id="ematt:173" target="_blank"><img alt="点击查看原图" border="0" src="http://be-evil.org/content/uploadfile/201002/aa17a7df9330b4ab503d8427b591433e20100228170959.png" /></a></p>
<p>
	选择完毕后点击&rdquo;<strong>确定</strong>&ldquo;即可完成安装过程</p>
<p>
	4.配置IIS7</p>
<p>
	进入&rdquo;控制面板&ldquo; - &quot;管理工具&rdquo; - 选择&quot;Internet信息服务(IIS)管理器&quot;</p>
<p>
	<a href="http://be-evil.org/content/uploadfile/201002/46183e8c4265bf5c93b3355e9173f52520100228170959.png" id="ematt:174" target="_blank"><img alt="点击查看原图" border="0" src="http://be-evil.org/content/uploadfile/201002/46183e8c4265bf5c93b3355e9173f52520100228170959.png" /></a></p>
<p>
	选择左侧的网站 - Default Web Site, 再双击右侧的&ldquo;<strong>处理程序映射</strong>&rdquo;</p>
<p>
	<a href="http://be-evil.org/content/uploadfile/201002/32620a1306a7c65fafb2ec297cc08d1620100228170959.png" id="ematt:175" target="_blank"><img alt="点击查看原图" border="0" src="http://be-evil.org/content/uploadfile/201002/32620a1306a7c65fafb2ec297cc08d1620100228170959.png" /></a></p>
<p>
	进入管理页面后再选择右侧菜单的&ldquo;<strong>添加模块映射</strong>&rdquo;</p>
<p>
	<a href="http://be-evil.org/content/uploadfile/201002/1360f8ee47edee9be492eeac0352fb7920100228170959.png" id="ematt:176" target="_blank"><img alt="点击查看原图" border="0" src="http://be-evil.org/content/uploadfile/201002/1360f8ee47edee9be492eeac0352fb7920100228170959.png" /></a></p>
<p>
	然后详细内容按照下图填写，注意可执行路径内容请根据自己机器上php-cgi的路径选择</p>
<p>
	<a href="http://be-evil.org/content/uploadfile/201002/b6a5e9481e63e763a0529ce4a5242cde20100228170959.png" id="ematt:177" target="_blank"><img alt="点击查看原图" border="0" src="http://be-evil.org/content/uploadfile/201002/thum-b6a5e9481e63e763a0529ce4a5242cde20100228170959.png" /></a></p>
<p>
	这时在IIS默认根目录新建一个文件phpinfo.php，输入</p>
<p>
	&lt;?php</p>
<p>
	phpinfo();</p>
<p>
	保存并使用浏览器访问 http://localhost/phpinfo.php</p>
<p>
	<a href="http://be-evil.org/content/uploadfile/201002/77ca19488abadb2bff4c60ae955a182720100228170959.png" id="ematt:178" target="_blank"><img alt="点击查看原图" border="0" src="http://be-evil.org/content/uploadfile/201002/thum-77ca19488abadb2bff4c60ae955a182720100228170959.png" /></a></p>
<p>
	如果一切正常则会像上图一样显示，恭喜，配置成功完成！</p>
<p>
	如果在配置和使用时出现疑难问题，可以参考我先前的文章</p>
<p>
	<a href="http://be-evil.org/post-111.html" target="_blank">IIS7配置PHP5.3问题解决笔记<br />
	</a></p>
<p>
	另外再附上官方的配置指南</p>
<p>
	<a href="http://cn.php.net/manual/en/install.windows.iis7.php" target="_blank">http://cn.php.net/manual/en/install.windows.iis7.php<br />
	</a></p><div id="related_log" style="font-size:12px"><p><b>相关日志：</b></p><p><a href="http://be-evil.org/?post=77">基于Zend Framework的分页类</a></p><p><a href="http://be-evil.org/?post=111">IIS7配置PHP5.3问题解决笔记</a></p><p><a href="http://be-evil.org/?post=140">php函数unserialize数据返回false问题分析</a></p><p><a href="http://be-evil.org/?post=104">Windows下自定义php.ini的位置</a></p><p><a href="http://be-evil.org/?post=117">php使用MySql函数导致Apache(iis)崩溃的问题</a></p><p><a href="http://be-evil.org/?post=59">PHP启动Gzip报handler 'ob_gzhandler' cannot be used twice错误解决</a></p><p><a href="http://be-evil.org/?post=38">php基础测试</a></p><p><a href="http://be-evil.org/?post=115">php在iis5下使用setcookie + header('Location')导致cookie失效的bug</a></p><p><a href="http://be-evil.org/?post=151">PHP函数strtotime理解笔记</a></p><p><a href="http://be-evil.org/?post=94">php连接SQL Server2000/2005的问题总结</a></p></div>]]></description>
	<pubDate>Sun, 28 Feb 2010 20:04:51 +0800</pubDate>
	<author>朦朧中的罪惡</author>
	<guid>http://be-evil.org/?post=150</guid>

</item>
<item>
	<title>PHP使用Session和全局变量开启时候出现waring提示的分析</title>
	<link>http://be-evil.org/?post=149</link>
	<description><![CDATA[<p>
	这个问题估计很少人会遇到，但是总有人会那么凑巧的给碰上<img alt="" src="http://be-evil.org/admin/ckeditor/plugins/smiley/images/1.gif" title="" /></p>
<p>
	PHP在运行时出现一个Waring，内容为</p>
<p>
	Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0.</p>
<p>
	如何触发这个Waring呢？首先php配置register_globals必须为Off</p>
<p>
	代码如下</p>
<p>
	<span style="color: rgb(0, 0, 255);">&lt;?php</span><br />
	<span style="color: rgb(0, 0, 0);">session_start</span>();<br />
	<span style="color: rgb(0, 0, 0);">$test</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(163, 21, 21);">&#39;be-evil&#39;</span> ; <br />
	<span style="color: rgb(0, 0, 0);">$_SESSION</span><span style="color: rgb(0, 0, 0);">[</span><span style="color: rgb(163, 21, 21);">&#39;test&#39;</span><span style="color: rgb(0, 0, 0);">]</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 255);">null</span>;</p>
<p>
	在register_globals为On的情况下，$test可能是由其他全局变量转换来的例如$_GET,$_POST;</p>
<p>
	但是在register_globals为Off的情况下，这里是创建了一个全局变量 test 切值为 null，解释器会认为你忘记全局变量关闭了，然后想修改全局变量$test的值...然后就会冒出这个善意的提醒了</p>
<p>
	<br />
	解决办法：</p>
<p>
	在PHP.ini中设定bug_compat_42或bug_compat_warn为Off即可</p>
<p>
	或者避免全局变量与Session变量名称同名</p>
<p>
	相关资料：</p>
<p>
	<a href="http://www.laruence.com/2009/07/13/976.html" target="_blank">PHP Session的一个警告<br />
	</a></p>
<p>
	<a href="http://www.php.net/manual/en/ref.session.php#55239" target="_blank">PHP手册Session评论中一个网友提到的这个问题<br />
	</a></p>
<p>
	&nbsp;</p>
<p>
	&nbsp;</p>
<p>
	&nbsp;</p><div id="related_log" style="font-size:12px"><p><b>相关日志：</b></p><p><a href="http://be-evil.org/?post=70">Eclipse+php插件+Xdebug搭建PHP完美开发/调试环境指南</a></p><p><a href="http://be-evil.org/?post=55">php引用(References)不完全研究</a></p><p><a href="http://be-evil.org/?post=66">Discuz!编辑器附件添加原理不完全研究</a></p><p><a href="http://be-evil.org/?post=59">PHP启动Gzip报handler 'ob_gzhandler' cannot be used twice错误解决</a></p><p><a href="http://be-evil.org/?post=102">PHP浮点数比较不准的解决方法</a></p><p><a href="http://be-evil.org/?post=104">Windows下自定义php.ini的位置</a></p><p><a href="http://be-evil.org/?post=151">PHP函数strtotime理解笔记</a></p><p><a href="http://be-evil.org/?post=100">PHP函数ereg与preg的区别</a></p><p><a href="http://be-evil.org/?post=11">PHP防范XSS跨站脚本攻击的函数</a></p><p><a href="http://be-evil.org/?post=94">php连接SQL Server2000/2005的问题总结</a></p></div>]]></description>
	<pubDate>Tue, 23 Feb 2010 19:38:50 +0800</pubDate>
	<author>朦朧中的罪惡</author>
	<guid>http://be-evil.org/?post=149</guid>

</item>
<item>
	<title>iPhone开发:UIScrollView分页算法</title>
	<link>http://be-evil.org/?post=148</link>
	<description><![CDATA[<p>
	在使用 UIScrollView 分页的时候我们如何确定当前是第几页？</p>
<p>
	首先需要开启分页设置</p>
<p>
	scrollView.pagingEnabled = YES;</p>
<p>
	然后我们在委托的类上实现以下方法</p>
<p>
	<span style="color: rgb(0, 0, 0);">-</span> (<span style="color: rgb(43, 145, 175);">void</span>) <span style="color: rgb(0, 0, 0);">scrollViewDidScroll:</span>(<span style="color: rgb(0, 0, 0);">UIScrollView</span> <span style="color: rgb(0, 0, 0);">*</span>)<span style="color: rgb(0, 0, 0);">sender</span> <span style="color: rgb(0, 0, 0);">{</span><br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 128, 0);">// 得到每页宽度</span><br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 0, 0);">CGFloat</span> <span style="color: rgb(0, 0, 0);">pageWidth</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">sender</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">frame</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">size</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">width</span>;<br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 128, 0);">// 根据当前的x坐标和页宽度计算出当前页数</span><br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(43, 145, 175);">int</span> <span style="color: rgb(0, 0, 0);">currentPage</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">floor</span>((<span style="color: rgb(0, 0, 0);">sender</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">contentOffset</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">x</span> <span style="color: rgb(0, 0, 0);">-</span> <span style="color: rgb(0, 0, 0);">pageWidth</span> <span style="color: rgb(0, 0, 0);">/</span> <span style="color: rgb(0, 0, 0);">2</span>) <span style="color: rgb(0, 0, 0);">/</span> <span style="color: rgb(0, 0, 0);">pageWidth</span>) <span style="color: rgb(0, 0, 0);">+</span> <span style="color: rgb(0, 0, 0);">1</span>;<br />
	<span style="color: rgb(0, 0, 0);">}</span></p><div id="related_log" style="font-size:12px"><p><b>相关日志：</b></p><p><a href="http://be-evil.org/?post=145">iPhone应用程序取得程序关闭事件的方法</a></p><p><a href="http://be-evil.org/?post=147">iPhone开发:通过NSURLRequest获得服务器返回的http header和http status</a></p></div>]]></description>
	<pubDate>Mon, 22 Feb 2010 20:09:00 +0800</pubDate>
	<author>朦朧中的罪惡</author>
	<guid>http://be-evil.org/?post=148</guid>

</item>
<item>
	<title>iPhone开发:通过NSURLRequest获得服务器返回的http header和http status</title>
	<link>http://be-evil.org/?post=147</link>
	<description><![CDATA[<p>
	同步访问时的取法</p>
<p>
	<span style="color: rgb(0, 0, 0);">NSURL</span> <span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">url</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">[</span><span style="color: rgb(0, 0, 0);">NSURL</span> <span style="color: rgb(0, 0, 0);">URLWithString:</span><span style="color: rgb(163, 21, 21);">@&quot;http://www.test.com&quot;</span><span style="color: rgb(0, 0, 0);">];</span><br />
	<span style="color: rgb(0, 0, 0);">NSURLRequest</span> <span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">request</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">[</span><span style="color: rgb(0, 0, 0);">NSURLRequest</span> <span style="color: rgb(0, 0, 0);">requestWithURL:</span> <span style="color: rgb(0, 0, 0);">url</span><span style="color: rgb(0, 0, 0);">];</span><br />
	<span style="color: rgb(0, 0, 0);">NSHTTPURLResponse</span> <span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">response</span>;<br />
	<span style="color: rgb(0, 0, 0);">[</span><span style="color: rgb(0, 0, 0);">NSURLConnection</span> <span style="color: rgb(0, 0, 0);">sendSynchronousRequest:</span> <span style="color: rgb(0, 0, 0);">request</span> <span style="color: rgb(0, 0, 0);">returningResponse:</span> <span style="color: rgb(0, 0, 0);">&amp;</span><span style="color: rgb(0, 0, 0);">response</span> <span style="color: rgb(0, 0, 0);">error:</span> <span style="color: rgb(0, 0, 0);">nil</span><span style="color: rgb(0, 0, 0);">];</span><br />
	<span style="color: rgb(0, 0, 255);">if</span> <span style="color: rgb(0, 0, 0);">([</span><span style="color: rgb(0, 0, 0);">response</span> <span style="color: rgb(0, 0, 0);">respondsToSelector:</span><span style="color: rgb(0, 0, 255);">@selector</span>(<span style="color: rgb(0, 0, 0);">allHeaderFields</span><span style="color: rgb(0, 0, 0);">)])</span> <span style="color: rgb(0, 0, 0);">{</span><br />
	&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 128, 0);">// 取得所有的请求的头</span><br />
	&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 0, 0);">NSDictionary</span> <span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">dictionary</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">[</span><span style="color: rgb(0, 0, 0);">response</span> <span style="color: rgb(0, 0, 0);">allHeaderFields</span><span style="color: rgb(0, 0, 0);">];</span><br />
	&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 0, 0);">NSLog</span><span style="color: rgb(0, 0, 0);">([</span><span style="color: rgb(0, 0, 0);">dictionary</span> <span style="color: rgb(0, 0, 0);">description</span><span style="color: rgb(0, 0, 0);">]);</span><br />
	&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 128, 0);">// 取得http状态码</span><span style="color: rgb(0, 128, 0);"><br />
	&nbsp;&nbsp;&nbsp; </span>NSLog(@&quot;%d&quot;,[<span style="color: rgb(0, 0, 0);">response</span> statusCode]);<br />
	<br />
	<span style="color: rgb(0, 0, 0);">}</span></p>
<p>
	&nbsp;</p>
<p>
	异步访问时则要实现委托的一个方法</p>
<p>
	<span style="color: rgb(0, 0, 0);">-</span> (<span style="color: rgb(43, 145, 175);">void</span>)<span style="color: rgb(0, 0, 0);">connection:</span>(<span style="color: rgb(0, 0, 0);">NSURLConnection</span> <span style="color: rgb(0, 0, 0);">*</span>)<span style="color: rgb(0, 0, 0);">connection</span> <span style="color: rgb(0, 0, 0);">didReceiveResponse:</span>(<span style="color: rgb(0, 0, 0);">NSURLResponse</span> <span style="color: rgb(0, 0, 0);">*</span>)<span style="color: rgb(0, 0, 0);">response</span> <span style="color: rgb(0, 0, 0);">{</span><br />
	&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 128, 0);">// 注意这里将NSURLResponse对象转换成NSHTTPURLResponse对象才能去</span><br />
	<span style="color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp; NSHTTPURLResponse</span> <span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">httpResponse</span> <span style="color: rgb(0, 0, 0);">=</span> (<span style="color: rgb(0, 0, 0);">NSHTTPURLResponse</span><span style="color: rgb(0, 0, 0);">*</span>)<span style="color: rgb(0, 0, 0);">response</span>;<br />
	&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 0, 255);">if</span> <span style="color: rgb(0, 0, 0);">([</span><span style="color: rgb(0, 0, 0);">response</span> <span style="color: rgb(0, 0, 0);">respondsToSelector:</span><span style="color: rgb(0, 0, 255);">@selector</span>(<span style="color: rgb(0, 0, 0);">allHeaderFields</span><span style="color: rgb(0, 0, 0);">)])</span> <span style="color: rgb(0, 0, 0);">{</span><br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 0, 0);">NSDictionary</span> <span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);">dictionary</span> <span style="color: rgb(0, 0, 0);">=</span> <span style="color: rgb(0, 0, 0);">[</span><span style="color: rgb(0, 0, 0);">httpResponse</span> <span style="color: rgb(0, 0, 0);">allHeaderFields</span><span style="color: rgb(0, 0, 0);">];</span><br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 0, 0);">NSLog</span><span style="color: rgb(0, 0, 0);">([</span><span style="color: rgb(0, 0, 0);">dictionary</span> <span style="color: rgb(0, 0, 0);">description</span><span style="color: rgb(0, 0, 0);">]);</span><br />
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NSLog(@&quot;%d&quot;,[<span style="color: rgb(0, 0, 0);">response</span> statusCode]);<br />
	<br />
	&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 0, 0);">}</span><br />
	<span style="color: rgb(0, 0, 0);">}</span></p><div id="related_log" style="font-size:12px"><p><b>相关日志：</b></p><p><a href="http://be-evil.org/?post=145">iPhone应用程序取得程序关闭事件的方法</a></p><p><a href="http://be-evil.org/?post=148">iPhone开发:UIScrollView分页算法</a></p></div>]]></description>
	<pubDate>Sun, 21 Feb 2010 12:22:44 +0800</pubDate>
	<author>朦朧中的罪惡</author>
	<guid>http://be-evil.org/?post=147</guid>

</item></channel>
</rss>