<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet href='http://feed.philna.com/styles/feedsky1.xsl' type='text/xsl' ?><!--这是一个由Feedsy提供技术支持的Feed，为了提高读者阅读的体验，以及满足用户美化自己Feed的需要，我们设计了多种精美的Feed模板，提供给大家选择，所有最终呈现出来的样式，皆由用户自愿选择使用，未经许可，任何团体和个人，请不要擅自修改样式或者盗用，这是对于用户选择权的尊重。--><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:fs="http://www.feedsky.com/namespace/feed" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link href="http://feed.feedsky.com/PhilNa" type="application/rss+xml" rel="self"></atom:link><fs:self_link href="http://feed.feedsky.com/PhilNa" type="application/rss+xml"></fs:self_link><lastBuildDate>Thu, 05 Aug 2010 15:03:21 GMT</lastBuildDate><title>PhilNa</title><description>找寻那些幸福...</description><image><url>http://www.feedsky.com/feed/PhilNa/sc/gif</url><title>PhilNa</title><link>http://philna.com</link></image><link>http://philna.com</link><sy:updatePeriod>hourly</sy:updatePeriod><sy:updateFrequency>1</sy:updateFrequency><language>en</language><pubDate>Thu, 05 Aug 2010 15:04:48 GMT</pubDate><item><title>阿里巴巴国际站 UED 招聘</title><link>http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375702/5391790/1/item.html</link><content:encoded>&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/PhilNa/400375702/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/PhilNa/400375702/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;钟爱 WEB 的朋友们, 大机会来了, 阿里巴巴国际站火热招兵买马中.&lt;/p&gt;
&lt;p&gt;不要在意的你学历, 不要怀疑你的本领. 阿里的实力有目共睹. 快快行动, 加入充满激情的阿里团队, 和你仰慕已久的牛人们一起实现你的梦想吧.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://2010.aliued.com/&quot; ref=&quot;external nofollow&quot;&gt;&lt;img class=&quot;sided&quot; src=&quot;http://www.neoease.com/wp-content/themes/paled/sponsors/aliued-500x146.gif&quot; alt=&quot;alibaba ued 2010 Recruitment&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-226&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;招聘概要:&lt;/h2&gt;
&lt;p&gt;地点: 杭州阿里巴巴总部&lt;br /&gt;
学历: 不限, 作品和实力是你最好的证明&lt;br /&gt;
资历: 不限, 我们提供平台, 无论你是应届生还是设计专家&lt;br /&gt;
英文: 擅长是优势, 不擅长是提升空间, 不是障碍&lt;/p&gt;
&lt;h2&gt;招人特征:&lt;/h2&gt;
&lt;p&gt;大同 &amp;#8211; 组织的内核要大同, 无论团队大小, 希望大家本性相近, 有共同的核&lt;br /&gt;
大异 &amp;#8211; 基因库越大越好, 所以, 欢迎你带来挑战, 带来创新, 带来变异&lt;br /&gt;
Bottom-up &amp;#8211; 网站人需要使命和方向, 不需要过多管理, 我的事我做主&lt;br /&gt;
Transparency &amp;#8211; 透明就是力量, 举例: 2010 开始个人晋升报名评选全程公开&lt;/p&gt;
&lt;h2&gt;招聘岗位:&lt;/h2&gt;
&lt;p&gt;交互设计师, 视觉设计师, 前端工程师, 用户研究员&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;简历请至:&lt;/strong&gt;&lt;br /&gt;
&lt;a href=&quot;mailto:ke.suk@alibaba-inc.com&quot;&gt;ke.suk@alibaba-inc.com&lt;/a&gt; (附件需小于 10MB)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;招聘详情请访问以下页面:&lt;/strong&gt;&lt;br /&gt;
&lt;a href=&quot;http://2010.aliued.com/&quot; ref=&quot;external&quot;&gt;阿里巴巴国际站 UED 招聘网站&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;P.S.&lt;br /&gt;
	哈哈, 抄袭了&lt;a href=&quot;http://www.neoease.com/alibaba-ued-2010-hiring/&quot; ref=&quot;external&quot;&gt;mg12哥&lt;/a&gt;的招聘介绍.&lt;/p&gt;
&lt;p&gt;	欢迎有优秀作品和丰富工作经验的朋友和 mg12 取得联络, 在招聘中你将有可能获得&lt;strong&gt;推荐和加分&lt;/strong&gt;.&lt;br /&gt;
&lt;h3&gt;Random Posts&lt;/h3&gt;
&lt;ul class=&quot;related_posts&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2008/10/i-make-a-move/&quot; title=&quot;我搬家了&quot; rel=&quot;bookmark inlinks&quot;&gt;我搬家了&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 1 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2008/10/what-plugins-i-have-installed/&quot; title=&quot;本站装的插件&quot; rel=&quot;bookmark inlinks&quot;&gt;本站装的插件&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 7 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/02/happy-new-year/&quot; title=&quot;给大家拜个晚年&quot; rel=&quot;bookmark inlinks&quot;&gt;给大家拜个晚年&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 7 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2008/11/braveheart/&quot; title=&quot;勇敢的心&quot; rel=&quot;bookmark inlinks&quot;&gt;勇敢的心&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 7 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2008/10/reinstall-system/&quot; title=&quot;又重装了系统&quot; rel=&quot;bookmark inlinks&quot;&gt;又重装了系统&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 5 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/03/widget-rss-output-twitter/&quot; title=&quot;边侧栏实时显示twitter消息&quot; rel=&quot;bookmark inlinks&quot;&gt;边侧栏实时显示twitter消息&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 14 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2008/10/flash-countdown/&quot; title=&quot;flash倒计时&quot; rel=&quot;bookmark inlinks&quot;&gt;flash倒计时&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 4 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2008/10/word-punctuation-conversion/&quot; title=&quot;中英文标点符号转换 word宏&quot; rel=&quot;bookmark inlinks&quot;&gt;中英文标点符号转换 word宏&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 2 )&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/400375702/PhilNa/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375702/5391790/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://philna.com/2010/08/alibaba-ued-2010-recruitment/feed/</wfw:commentRss><slash:comments>0</slash:comments><description>&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/PhilNa/400375702/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/PhilNa/400375702/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;钟爱 WEB 的朋友们, 大机会来了, 阿里巴巴国际站火热招兵买马中. 不要在意的你学历, 不要怀疑你的本领. 阿里的实力有目共睹. 快快行动, 加入充满激情的阿里团队, 和你仰慕已久的牛人们一起实现你的梦想吧. 招聘概要: 地点: 杭州阿里巴巴总部 学历: 不限, 作品和实力是你最好的证明 资历: 不限, 我们提供平台, 无论你是应届生还是设计专家 英文: 擅长是优势, 不擅长是提升空间, 不是障碍 招人特征: 大同 &amp;#8211; 组织的内核要大同, 无论团队大小, 希望大家本性相近, 有共同的核 大异 &amp;#8211; 基因库越大越好, 所以, 欢迎你带来挑战, 带来创新, 带来变异 Bottom-up &amp;#8211; 网站人需要使命和方向, 不需要过多管理, 我的事我做主 Transparency &amp;#8211; 透明就是力量, 举例: 2010 开始个人晋升报名评选全程公开 招聘岗位: 交互设计师, 视觉设计师, 前端工程师, 用户研究员 [...]&lt;img src=&quot;http://www1.feedsky.com/t1/400375702/PhilNa/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375702/5391790/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>Other Stuff</category><pubDate>Thu, 05 Aug 2010 23:03:21 +0800</pubDate><author>yinheli</author><comments>http://philna.com/2010/08/alibaba-ued-2010-recruitment/#comments</comments><guid isPermaLink="false">http://philna.com/?p=226</guid><dc:creator>yinheli</dc:creator><fs:srclink>http://philna.com/2010/08/alibaba-ued-2010-recruitment/</fs:srclink><fs:srcfeed>http://philna.com/feed</fs:srcfeed><fs:itemid>feedsky/PhilNa/~7212539/400375702/5391790</fs:itemid></item><item><title>获取 VeryCD 站点标题</title><link>http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375703/5391790/1/item.html</link><content:encoded>&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/PhilNa/400375703/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/PhilNa/400375703/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;前段时间眼红好友们的人人帐号级别都很高, 我就写了一个模拟登录的脚本, 每天定时登录人人并发布一个新的状态, 加快升级. 在考虑状态用语的时候, 突然想到了电驴子 VeryCD 的标题每次都不一样, 而且很多语句都非常励志, 或者积极向上. 于是考虑把它爬下来, 随机选择一个, 作为人人网状态发布. 现在我把读取 VeryCD 网站标题的代码张贴一下.  &lt;img src='http://philna.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /&gt;  &lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-225&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;PHP 方式&lt;/h2&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre class=&quot;php&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #009933;&quot;&gt;/**
 * 取得当日 VeryCD 的随机标题
 * 
 * @return array
 */&lt;/span&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; getTitlesOfVeryCD&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
	&lt;span style=&quot;color: #000088;&quot;&gt;$orgContent&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;file_get_contents&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;'http://www.verycd.com/statics/title.saying'&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	&lt;span style=&quot;color: #000088;&quot;&gt;$matchResult&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;preg_match&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;'/new\s+Array\((.+)\);\s+_VC_/'&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$orgContent&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$matches&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	&lt;span style=&quot;color: #000088;&quot;&gt;$results&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;array&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$matchResult&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
		&lt;span style=&quot;color: #000088;&quot;&gt;$results&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;explode&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;'\'&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;', $matches[1]);
		foreach ($results as &amp;amp;$v) {
			$v = str_replace('&lt;/span&gt;\&lt;span style=&quot;color: #0000ff;&quot;&gt;''&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;''&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$v&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
		&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
	&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;	
	&lt;span style=&quot;color: #990000;&quot;&gt;unset&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$orgContent&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$matches&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$results&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;Java 方式&lt;/h3&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre class=&quot;java&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;java.io.BufferedReader&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;java.io.IOException&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;java.io.InputStreamReader&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;java.net.URL&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;java.util.regex.Matcher&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;java.util.regex.Pattern&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #008000; font-style: italic; font-weight: bold;&quot;&gt;/**
 * 读取 VeryCD 的随机标题
 * 
 * @author yinheli
 *
 */&lt;/span&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; TitlesOfVeryCD &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
	&lt;span style=&quot;color: #008000; font-style: italic; font-weight: bold;&quot;&gt;/**
	 * 取得当日全部的标题
	 * 
	 * @return 当天的标题数组
	 * @throws IOException
	 */&lt;/span&gt;
	&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt; get&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;throws&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;IOException&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
		&lt;span style=&quot;color: #003399;&quot;&gt;URL&lt;/span&gt; url &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;URL&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;http://www.verycd.com/statics/title.saying&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
		&lt;span style=&quot;color: #003399;&quot;&gt;BufferedReader&lt;/span&gt; br &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;BufferedReader&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;
			&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;InputStreamReader&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;
				url.&lt;span style=&quot;color: #006633;&quot;&gt;openConnection&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;getInputStream&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;
			&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;
		&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
		StringBuilder contentSB &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; StringBuilder&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
		&lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt; line &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
		&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;line &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; br.&lt;span style=&quot;color: #006633;&quot;&gt;readLine&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;!=&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
			contentSB.&lt;span style=&quot;color: #006633;&quot;&gt;append&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;line&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
		&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
		br.&lt;span style=&quot;color: #006633;&quot;&gt;close&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
		&lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt; content &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; contentSB.&lt;span style=&quot;color: #006633;&quot;&gt;toString&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
		Pattern p &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; Pattern.&lt;span style=&quot;color: #006633;&quot;&gt;compile&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;new&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;s+Array&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;((.+)&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;);&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;s+_VC_&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
		Matcher m &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; p.&lt;span style=&quot;color: #006633;&quot;&gt;matcher&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;content&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
		&lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt; results &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
		&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;m.&lt;span style=&quot;color: #006633;&quot;&gt;find&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
			results &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; m.&lt;span style=&quot;color: #006633;&quot;&gt;group&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;split&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;',&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;s?&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
			&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;for&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;int&lt;/span&gt; i &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; i &lt;span style=&quot;color: #339933;&quot;&gt;&amp;lt;&lt;/span&gt; results.&lt;span style=&quot;color: #006633;&quot;&gt;length&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; i&lt;span style=&quot;color: #339933;&quot;&gt;++&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
				results&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;i&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; results&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;i&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;replace&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;'&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
			&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
		&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
		&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;return&lt;/span&gt; results&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;Related Posts&lt;/h3&gt;
&lt;ul class=&quot;related_posts&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/03/close-the-ads/&quot; title=&quot;给广告一个关闭的按钮&quot; rel=&quot;bookmark inlinks&quot;&gt;给广告一个关闭的按钮&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 22 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2008/11/php-substr/&quot; title=&quot;Php substr截取中文乱码&quot; rel=&quot;bookmark inlinks&quot;&gt;Php substr截取中文乱码&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 6 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/10/nofollow-links/&quot; title=&quot;给首页的友情链接添加 nofollow&quot; rel=&quot;bookmark inlinks&quot;&gt;给首页的友情链接添加 nofollow&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 25 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2010/05/smallimagetool/&quot; title=&quot;图片批量压缩小工具&quot; rel=&quot;bookmark inlinks&quot;&gt;图片批量压缩小工具&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 15 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/02/php-verification-code/&quot; title=&quot;Php图片验证&quot; rel=&quot;bookmark inlinks&quot;&gt;Php图片验证&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 16 )&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/400375703/PhilNa/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375703/5391790/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://philna.com/2010/06/get-titles-of-verycd/feed/</wfw:commentRss><slash:comments>35</slash:comments><description>&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/PhilNa/400375703/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/PhilNa/400375703/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;前段时间眼红好友们的人人帐号级别都很高, 我就写了一个模拟登录的脚本, 每天定时登录人人并发布一个新的状态, 加快升级. 在考虑状态用语的时候, 突然想到了电驴子 VeryCD 的标题每次都不一样, 而且很多语句都非常励志, 或者积极向上. 于是考虑把它爬下来, 随机选择一个, 作为人人网状态发布. 现在我把读取 VeryCD 网站标题的代码张贴一下. PHP 方式 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 /** * 取得当日 VeryCD 的随机标题 * * @return array */ function getTitlesOfVeryCD&amp;#40;&amp;#41; &amp;#123; $orgContent = file_get_contents&amp;#40;'http://www.verycd.com/statics/title.saying'&amp;#41;; $matchResult = preg_match&amp;#40;'/new\s+Array\((.+)\);\s+_VC_/', [...]&lt;img src=&quot;http://www1.feedsky.com/t1/400375703/PhilNa/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375703/5391790/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>php</category><category>Java</category><category>Technology</category><pubDate>Wed, 16 Jun 2010 12:20:32 +0800</pubDate><author>yinheli</author><comments>http://philna.com/2010/06/get-titles-of-verycd/#comments</comments><guid isPermaLink="false">http://philna.com/2010/06/get-titles-of-verycd/</guid><dc:creator>yinheli</dc:creator><fs:srclink>http://philna.com/2010/06/get-titles-of-verycd/</fs:srclink><fs:srcfeed>http://philna.com/feed</fs:srcfeed><fs:itemid>feedsky/PhilNa/~7212539/400375703/5391790</fs:itemid></item><item><title>唉~ WordPress</title><link>http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375704/5391790/1/item.html</link><content:encoded>&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/PhilNa/400375704/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/PhilNa/400375704/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;这几天因为需要, 硬着头皮看 WordPress 的源代码, 我不得不说这太痛苦了, 突然有一种想要抛弃他的感觉.&lt;/p&gt;
&lt;p&gt;实在是受不了它那 html 和 php 代码夹杂的写法, 夹着写算了, 问题是它里面还有很复杂的流程控制代码, 光是找括弧就能把人整晕了. 又看看 typecho 的代码, 确实要清爽很多&amp;#8230; 有一种换掉的冲动啊.&lt;/p&gt;
&lt;h3&gt;Random Posts&lt;/h3&gt;
&lt;ul class=&quot;related_posts&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2008/10/prison-break-postpone/&quot; title=&quot;我最喜欢的美剧 越狱 第四季 第八集 延后播出&quot; rel=&quot;bookmark inlinks&quot;&gt;我最喜欢的美剧 越狱 第四季 第八集 延后播出&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 0 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2008/09/feel-good/&quot; title=&quot;心情不错,我的博客终于搭建起来了 我要感谢...&quot; rel=&quot;bookmark inlinks&quot;&gt;心情不错,我的博客终于搭建起来了 我要感谢&amp;#8230;&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 10 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2008/12/updata-to-wordpress27/&quot; title=&quot;还是升级了&quot; rel=&quot;bookmark inlinks&quot;&gt;还是升级了&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 22 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2008/10/what-plugins-i-have-installed/&quot; title=&quot;本站装的插件&quot; rel=&quot;bookmark inlinks&quot;&gt;本站装的插件&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 7 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2008/10/terminator-pause-for-a-week/&quot; title=&quot;FOX电视台的 终结者外传 也停播一个星期!&quot; rel=&quot;bookmark inlinks&quot;&gt;FOX电视台的 终结者外传 也停播一个星期!&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 0 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2008/10/yesterday-put-on-a-new-theme/&quot; title=&quot;昨天换上了新的主题&quot; rel=&quot;bookmark inlinks&quot;&gt;昨天换上了新的主题&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 3 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2008/11/the-voice-come-from-obama/&quot; title=&quot;奥巴马的声音&quot; rel=&quot;bookmark inlinks&quot;&gt;奥巴马的声音&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 3 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/03/update-comment-in-one-time/&quot; title=&quot;同步更新边侧栏评论&quot; rel=&quot;bookmark inlinks&quot;&gt;同步更新边侧栏评论&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 42 )&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/400375704/PhilNa/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375704/5391790/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://philna.com/2010/06/something-about-wordpress/feed/</wfw:commentRss><slash:comments>32</slash:comments><description>&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/PhilNa/400375704/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/PhilNa/400375704/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;这几天因为需要, 硬着头皮看 WordPress 的源代码, 我不得不说这太痛苦了, 突然有一种想要抛弃他的感觉. 实在是受不了它那 html 和 php 代码夹杂的写法, 夹着写算了, 问题是它里面还有很复杂的流程控制代码, 光是找括弧就能把人整晕了. 又看看 typecho 的代码, 确实要清爽很多&amp;#8230; 有一种换掉的冲动啊. Random Posts winrar 8 下载( 2 ) 域名备案通成功( 8 ) 我也SEO( 16 ) 分享js下雪效果( 7 ) FOX电视台的 终结者外传 也停播一个星期!( 0 ) 截取js动态生成的HTML内容( 5 ) 本站装的插件( 7 ) 同步更新边侧栏评论( 42 )&lt;img src=&quot;http://www1.feedsky.com/t1/400375704/PhilNa/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375704/5391790/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>Other Stuff</category><pubDate>Wed, 09 Jun 2010 13:27:06 +0800</pubDate><author>yinheli</author><comments>http://philna.com/2010/06/something-about-wordpress/#comments</comments><guid isPermaLink="false">http://philna.com/2010/06/something-about-wordpress/</guid><dc:creator>yinheli</dc:creator><fs:srclink>http://philna.com/2010/06/something-about-wordpress/</fs:srclink><fs:srcfeed>http://philna.com/feed</fs:srcfeed><fs:itemid>feedsky/PhilNa/~7212539/400375704/5391790</fs:itemid></item><item><title>MySQL 的级联删除</title><link>http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375705/5391790/1/item.html</link><content:encoded>&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/PhilNa/400375705/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/PhilNa/400375705/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;在学习 Hibernate 的时候遇到 MySQL 的级联删除问题. 这里做个笔记:&lt;/p&gt;
&lt;p&gt;要实现级联删除效果, DDL 语句要注意:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;engine=Innodb, 必须使用InnoDB引擎&lt;/li&gt;
&lt;li&gt;外键必须建立索引.(如果没有创建, 系统会自动为你创建.)&lt;/li&gt;
&lt;li&gt;约束条件要写成表级约束. referential action 设置为 cascade (列级约束好像不起作用)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span id=&quot;more-223&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;范例&lt;/strong&gt; (student 表为 school_class 表的一个子表)&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;div class=&quot;code&quot;&gt;&lt;pre class=&quot;mysql&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #990099; font-weight: bold;&quot;&gt;create&lt;/span&gt; &lt;span style=&quot;color: #990099; font-weight: bold;&quot;&gt;table&lt;/span&gt; students&lt;span style=&quot;color: #FF00FF;&quot;&gt;&amp;#40;&lt;/span&gt;
	id &lt;span style=&quot;color: #999900; font-weight: bold;&quot;&gt;bigint&lt;/span&gt; &lt;span style=&quot;color: #CC0099; font-weight: bold;&quot;&gt;not&lt;/span&gt; &lt;span style=&quot;color: #9900FF; font-weight: bold;&quot;&gt;null&lt;/span&gt; &lt;span style=&quot;color: #990099; font-weight: bold;&quot;&gt;primary key&lt;/span&gt; &lt;span style=&quot;color: #FF9900; font-weight: bold;&quot;&gt;auto_increment&lt;/span&gt;&lt;span style=&quot;color: #000033;&quot;&gt;,&lt;/span&gt;
	sid &lt;span style=&quot;color: #999900; font-weight: bold;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: #FF00FF;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;20&lt;/span&gt;&lt;span style=&quot;color: #FF00FF;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #CC0099; font-weight: bold;&quot;&gt;not&lt;/span&gt; &lt;span style=&quot;color: #9900FF; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #000033;&quot;&gt;,&lt;/span&gt;
	name &lt;span style=&quot;color: #999900; font-weight: bold;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: #FF00FF;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;20&lt;/span&gt;&lt;span style=&quot;color: #FF00FF;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #CC0099; font-weight: bold;&quot;&gt;not&lt;/span&gt; &lt;span style=&quot;color: #9900FF; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #000033;&quot;&gt;,&lt;/span&gt;
	age &lt;span style=&quot;color: #999900; font-weight: bold;&quot;&gt;tinyint&lt;/span&gt; &lt;span style=&quot;color: #FF9900; font-weight: bold;&quot;&gt;unsigned&lt;/span&gt; &lt;span style=&quot;color: #CC0099; font-weight: bold;&quot;&gt;not&lt;/span&gt; &lt;span style=&quot;color: #9900FF; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #000033;&quot;&gt;,&lt;/span&gt;
	gender &lt;span style=&quot;color: #999900; font-weight: bold;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: #FF00FF;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #008080;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #FF00FF;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #CC0099; font-weight: bold;&quot;&gt;not&lt;/span&gt; &lt;span style=&quot;color: #9900FF; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #000033;&quot;&gt;,&lt;/span&gt;
	cid &lt;span style=&quot;color: #999900; font-weight: bold;&quot;&gt;bigint&lt;/span&gt; &lt;span style=&quot;color: #CC0099; font-weight: bold;&quot;&gt;not&lt;/span&gt; &lt;span style=&quot;color: #9900FF; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #000033;&quot;&gt;,&lt;/span&gt;
	&lt;span style=&quot;color: #990099; font-weight: bold;&quot;&gt;index&lt;/span&gt;&lt;span style=&quot;color: #FF00FF;&quot;&gt;&amp;#40;&lt;/span&gt;cid&lt;span style=&quot;color: #FF00FF;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000033;&quot;&gt;,&lt;/span&gt;
	&lt;span style=&quot;color: #990099; font-weight: bold;&quot;&gt;constraint&lt;/span&gt; &lt;span style=&quot;color: #990099; font-weight: bold;&quot;&gt;foreign key&lt;/span&gt;&lt;span style=&quot;color: #FF00FF;&quot;&gt;&amp;#40;&lt;/span&gt;cid&lt;span style=&quot;color: #FF00FF;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #990099; font-weight: bold;&quot;&gt;references&lt;/span&gt; school_class&lt;span style=&quot;color: #FF00FF;&quot;&gt;&amp;#40;&lt;/span&gt;id&lt;span style=&quot;color: #FF00FF;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #990099; font-weight: bold;&quot;&gt;on&lt;/span&gt; &lt;span style=&quot;color: #990099; font-weight: bold;&quot;&gt;delete&lt;/span&gt; &lt;span style=&quot;color: #990099; font-weight: bold;&quot;&gt;cascade&lt;/span&gt;
&lt;span style=&quot;color: #FF00FF;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #990099; font-weight: bold;&quot;&gt;engine&lt;/span&gt;&lt;span style=&quot;color: #CC0099;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #990099; font-weight: bold;&quot;&gt;Innodb&lt;/span&gt;&lt;span style=&quot;color: #000033;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF9900; font-weight: bold;&quot;&gt;charset&lt;/span&gt;&lt;span style=&quot;color: #CC0099;&quot;&gt;=&lt;/span&gt;utf8&lt;span style=&quot;color: #000033;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3&gt;Related Posts&lt;/h3&gt;
&lt;ul class=&quot;related_posts&quot;&gt;
&lt;li&gt;Not found.&lt;/li&gt;
&lt;/ul&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/400375705/PhilNa/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375705/5391790/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://philna.com/2010/05/mysql-cascade-delete/feed/</wfw:commentRss><slash:comments>12</slash:comments><description>&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/PhilNa/400375705/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/PhilNa/400375705/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;在学习 Hibernate 的时候遇到 MySQL 的级联删除问题. 这里做个笔记: 要实现级联删除效果, DDL 语句要注意: engine=Innodb, 必须使用InnoDB引擎 外键必须建立索引.(如果没有创建, 系统会自动为你创建.) 约束条件要写成表级约束. referential action 设置为 cascade (列级约束好像不起作用) 范例 (student 表为 school_class 表的一个子表) create table students&amp;#40; id bigint not null primary key auto_increment, sid varchar&amp;#40;20&amp;#41; not null, name varchar&amp;#40;20&amp;#41; not null, age tinyint unsigned not null, gender varchar&amp;#40;10&amp;#41; not null, cid bigint not null, [...]&lt;img src=&quot;http://www1.feedsky.com/t1/400375705/PhilNa/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375705/5391790/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>MySQL</category><category>Other Stuff</category><pubDate>Tue, 25 May 2010 22:33:02 +0800</pubDate><author>yinheli</author><comments>http://philna.com/2010/05/mysql-cascade-delete/#comments</comments><guid isPermaLink="false">http://philna.com/2010/05/mysql-cascade-delete/</guid><dc:creator>yinheli</dc:creator><fs:srclink>http://philna.com/2010/05/mysql-cascade-delete/</fs:srclink><fs:srcfeed>http://philna.com/feed</fs:srcfeed><fs:itemid>feedsky/PhilNa/~7212539/400375705/5391790</fs:itemid></item><item><title>图片批量压缩小工具</title><link>http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375706/5391790/1/item.html</link><content:encoded>&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/PhilNa/400375706/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/PhilNa/400375706/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;学 Java 有一段时间了, 其实也没有写过什么东西, 每天大部分都在熟悉语法而已, 只在 main 方法里或用 JUnit 写点测试的小东西. 现在把前段时间写的一个小工具发出来吧.&lt;/p&gt;
&lt;p&gt;具体来说上上个礼拜的事了. 我去 &lt;a href=&quot;http://anzhiba.com/&quot; title=&quot;Grubylee 的个人博客&quot;&gt;Grubylee&lt;/a&gt; 那玩, 他顺便给我提了一个需求, 说是学校网络工作站负责发布新闻的机器很破旧, 基本无法使用 PS 这样大个头的软件来处理照片, 负责发布新闻的学弟学妹们也因为技术和时间有限, 因此处理拍回来的新闻照片成了一件很头疼的事情, 期望能用 java 写个小工具来解决一下. &lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-222&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;我摩拳擦掌, 当天晚上就动手了, 大概花了2个多小时完成了这个小工具的初级版本.&lt;/p&gt;
&lt;p&gt;界面使用 NetBeans 画的(5,6分钟就搞定, 我比较懒. 哈哈), 处理逻辑在 eclipse 下写. NetBeans 我基本不会用. 还是习惯 eclipse 的代码提示和自动完成.&lt;/p&gt;
&lt;p&gt;由于对图片的处理我非常不熟悉, 以前基本没接触过, 所以这个小工具还有点问题&amp;#8230;. 但是基本还能用吧&amp;#8230;.&lt;/p&gt;
&lt;p&gt;所以只是发出来做个备份. 有兴趣的朋友可以给我提点建议, 或者干脆给我一解决方案最好, 哈哈~ &lt;img src='http://philna.com/wp-includes/images/smilies/icon_razz.gif' alt=':razz:' class='wp-smiley' /&gt;  &lt;/p&gt;
&lt;p&gt;源代码和可执行的 jar 包可以到 &lt;a href=&quot;http://code.google.com/p/yinheli/downloads/list&quot;&gt;Google code 下载&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Related Posts&lt;/h3&gt;
&lt;ul class=&quot;related_posts&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2010/06/get-titles-of-verycd/&quot; title=&quot;获取 VeryCD 站点标题&quot; rel=&quot;bookmark inlinks&quot;&gt;获取 VeryCD 站点标题&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 35 )&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/400375706/PhilNa/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375706/5391790/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://philna.com/2010/05/smallimagetool/feed/</wfw:commentRss><slash:comments>15</slash:comments><description>&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/PhilNa/400375706/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/PhilNa/400375706/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;学 Java 有一段时间了, 其实也没有写过什么东西, 每天大部分都在熟悉语法而已, 只在 main 方法里或用 JUnit 写点测试的小东西. 现在把前段时间写的一个小工具发出来吧. 具体来说上上个礼拜的事了. 我去 Grubylee 那玩, 他顺便给我提了一个需求, 说是学校网络工作站负责发布新闻的机器很破旧, 基本无法使用 PS 这样大个头的软件来处理照片, 负责发布新闻的学弟学妹们也因为技术和时间有限, 因此处理拍回来的新闻照片成了一件很头疼的事情, 期望能用 java 写个小工具来解决一下. 我摩拳擦掌, 当天晚上就动手了, 大概花了2个多小时完成了这个小工具的初级版本. 界面使用 NetBeans 画的(5,6分钟就搞定, 我比较懒. 哈哈), 处理逻辑在 eclipse 下写. NetBeans 我基本不会用. 还是习惯 eclipse 的代码提示和自动完成. 由于对图片的处理我非常不熟悉, 以前基本没接触过, 所以这个小工具还有点问题&amp;#8230;. 但是基本还能用吧&amp;#8230;. 所以只是发出来做个备份. 有兴趣的朋友可以给我提点建议, 或者干脆给我一解决方案最好, 哈哈~ 源代码和可执行的 jar 包可以到 Google code 下载. [...]&lt;img src=&quot;http://www1.feedsky.com/t1/400375706/PhilNa/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375706/5391790/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>Java</category><pubDate>Thu, 20 May 2010 21:27:08 +0800</pubDate><author>yinheli</author><comments>http://philna.com/2010/05/smallimagetool/#comments</comments><guid isPermaLink="false">http://philna.com/2010/05/smallimagetool/</guid><dc:creator>yinheli</dc:creator><fs:srclink>http://philna.com/2010/05/smallimagetool/</fs:srclink><fs:srcfeed>http://philna.com/feed</fs:srcfeed><fs:itemid>feedsky/PhilNa/~7212539/400375706/5391790</fs:itemid></item><item><title>回归</title><link>http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375707/5391790/1/item.html</link><content:encoded>&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/PhilNa/400375707/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/PhilNa/400375707/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;很久没有更新博客.&lt;/p&gt;
&lt;p&gt;这期间发生了太多太多的事情. 感触很深. 甚至对我的人生态度都有很大的改变.&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-221&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;List:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#brother&quot;&gt;弟弟从电梯上摔伤.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#exam&quot;&gt;我的考研很失败.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#love&quot;&gt;放下了那段往事.&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#plan&quot;&gt;开始有了新的计划. &amp;#8211; 学习计算机.&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;brother&quot;&gt;弟弟是我的英雄&lt;/h3&gt;
&lt;p&gt;摔得多出骨折的弟弟坚强地挺过了所有手术的伤痛. 他的伤痛同时也是我的伤痛. 很多时候我不知道要如何去表达. 几十年来我觉得亏欠弟弟的太多&amp;#8230; &lt;/p&gt;
&lt;p&gt;乐观的一面是, 弟弟一直很坚强, 保持良好的心态, 从来没有在家人目前流过一滴眼泪. 他是我的英雄, 一生的英雄.&lt;/p&gt;
&lt;h3 id=&quot;exam&quot;&gt;至于考试&lt;/h3&gt;
&lt;p&gt;关于考试我很郁闷. 其实还能怪谁呢? 是自己还不够努力. 对未来总是很迷茫. 这几年感觉一直很抑郁. 现在反过头来想想. 我真的不喜欢学医? 也许并不是, 我只是无法适应我处的环境. 5年过来, 我从未发现自我的价值所在. 反倒是被人冷落的声音不绝于耳. 所以我选择逃避, 离开.&lt;/p&gt;
&lt;h3 id=&quot;love&quot;&gt;该忘记了&lt;/h3&gt;
&lt;p&gt;以前是&amp;#8217;你离开了, 我还留在那伤心的地方&amp;#8217;, 现在明白了, 有些事情, 该放下了, 就不值得再去坚持. 关于幸福, 她有她自己的选择.&lt;/p&gt;
&lt;h3 id=&quot;plan&quot;&gt;计划&lt;/h3&gt;
&lt;p&gt;这个计划其实在考研之前就开始萌发. 我想去学编程. 比较系统的了解一下. 事实上这个计划已经在执行了. 尽管不少人反对. 我只是想趁自己还没有老去, 尝试一下自己喜欢的事情. &lt;/p&gt;
&lt;p&gt;在这期间我也有了新的收获, 结交了新的朋友. 上个礼拜的迟到事件更我体会到, 原来, 除了家人还有这么多人也关心我. 这是我在大学里没有体会到的. &lt;/p&gt;
&lt;p&gt;这期间的学习, 我不敢说我学的很好, 但是很努力, 现在日子很充实. &lt;/p&gt;
&lt;p&gt;我还得继续努力, 希望能找到一个好工作.&lt;/p&gt;
&lt;h3&gt;关于博客&lt;/h3&gt;
&lt;p&gt;是的我回来了, 我还会继续更新日志.&lt;/p&gt;
&lt;p&gt;很多评论和邮件没有回复, 现在也错过回复的时间了&amp;#8230; 这里给大家道歉~&lt;/p&gt;
&lt;h3&gt;期望&amp;#8230;&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;弟弟要快一点康复&amp;#8230;.&lt;/li&gt;
&lt;li&gt;我毕业后能找到好工作&amp;#8230;&lt;/li&gt;
&lt;li&gt;大家都平平安安的&amp;#8230;&lt;/li&gt;
&lt;li&gt;&amp;#8230;&amp;#8230;&amp;#8230;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;省略 N 条&lt;/p&gt;
&lt;h3&gt;Random Posts&lt;/h3&gt;
&lt;ul class=&quot;related_posts&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/02/get-feed-add-some-personality/&quot; title=&quot;给feed输出内容添加些'个性'&quot; rel=&quot;bookmark inlinks&quot;&gt;给feed输出内容添加些&amp;#8217;个性&amp;#8217;&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 11 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2008/11/seo-wordpress-header/&quot; title=&quot;Wordpress的head优化&quot; rel=&quot;bookmark inlinks&quot;&gt;WordPress的head优化&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 13 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2008/10/prison-break-4-8/&quot; title=&quot;越狱四季第8集&quot; rel=&quot;bookmark inlinks&quot;&gt;越狱四季第8集&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 3 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/03/widget-rss-output-twitter/&quot; title=&quot;边侧栏实时显示twitter消息&quot; rel=&quot;bookmark inlinks&quot;&gt;边侧栏实时显示twitter消息&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 14 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/02/i-like-g7v4/&quot; title=&quot;瞄上G7v4&quot; rel=&quot;bookmark inlinks&quot;&gt;瞄上G7v4&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 8 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2008/12/js-copyright/&quot; title=&quot;用js适当添加版权信息&quot; rel=&quot;bookmark inlinks&quot;&gt;用js适当添加版权信息&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 14 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/04/phina2/&quot; title=&quot;主题发布: PhilNa2 &quot; rel=&quot;bookmark inlinks&quot;&gt;主题发布: PhilNa2 &lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 135 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/02/using-g7v4/&quot; title=&quot;换上丸子的皮&quot; rel=&quot;bookmark inlinks&quot;&gt;换上丸子的皮&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 16 )&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/400375707/PhilNa/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375707/5391790/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://philna.com/2010/05/back/feed/</wfw:commentRss><slash:comments>33</slash:comments><description>&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/PhilNa/400375707/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/PhilNa/400375707/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;很久没有更新博客. 这期间发生了太多太多的事情. 感触很深. 甚至对我的人生态度都有很大的改变. List: 弟弟从电梯上摔伤. 我的考研很失败. 放下了那段往事. 开始有了新的计划. &amp;#8211; 学习计算机. 弟弟是我的英雄 摔得多出骨折的弟弟坚强地挺过了所有手术的伤痛. 他的伤痛同时也是我的伤痛. 很多时候我不知道要如何去表达. 几十年来我觉得亏欠弟弟的太多&amp;#8230; 乐观的一面是, 弟弟一直很坚强, 保持良好的心态, 从来没有在家人目前流过一滴眼泪. 他是我的英雄, 一生的英雄. 至于考试 关于考试我很郁闷. 其实还能怪谁呢? 是自己还不够努力. 对未来总是很迷茫. 这几年感觉一直很抑郁. 现在反过头来想想. 我真的不喜欢学医? 也许并不是, 我只是无法适应我处的环境. 5年过来, 我从未发现自我的价值所在. 反倒是被人冷落的声音不绝于耳. 所以我选择逃避, 离开. 该忘记了 以前是&amp;#8217;你离开了, 我还留在那伤心的地方&amp;#8217;, 现在明白了, 有些事情, 该放下了, 就不值得再去坚持. 关于幸福, 她有她自己的选择. 计划 这个计划其实在考研之前就开始萌发. 我想去学编程. 比较系统的了解一下. 事实上这个计划已经在执行了. 尽管不少人反对. 我只是想趁自己还没有老去, 尝试一下自己喜欢的事情. 在这期间我也有了新的收获, [...]&lt;img src=&quot;http://www1.feedsky.com/t1/400375707/PhilNa/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375707/5391790/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>Diary</category><pubDate>Mon, 03 May 2010 11:10:05 +0800</pubDate><author>yinheli</author><comments>http://philna.com/2010/05/back/#comments</comments><guid isPermaLink="false">http://philna.com/2010/05/back/</guid><dc:creator>yinheli</dc:creator><fs:srclink>http://philna.com/2010/05/back/</fs:srclink><fs:srcfeed>http://philna.com/feed</fs:srcfeed><fs:itemid>feedsky/PhilNa/~7212539/400375707/5391790</fs:itemid></item><item><title>数组重载在 WordPress 主题或插件设置中的应用</title><link>http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375708/5391790/1/item.html</link><content:encoded>&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/PhilNa/400375708/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/PhilNa/400375708/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;现在大部分的 WordPress 主题和插件都有后台设置页面, 为主题或插件添加自定义的一些功能. 这些设置会将被保存到数据库中. 然后在主题或插件中使用它们. 通常人们都是用 global 这样的关键字将他们的设置声明为一个全局变量. 或者在各个页面上都使用 get_options 这样的函数去取得设置. 然而我觉得那样处理并不好. 这里我写了个自认为较好的办法. 欢迎大家批评指正.&lt;/p&gt;
&lt;p&gt;该方法用到了数组重载. 数组重载是将对象作为数组使用的一个过程. 为了实现这个你需要用到 ArrayAccess 接口.&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-220&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;以下是 ArrayAccess 接口代码清单:&lt;/h3&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre class=&quot;php&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;interface&lt;/span&gt; ArrayAccess  &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
&amp;nbsp;
	&lt;span style=&quot;color: #009933;&quot;&gt;/**
	 * @param offset 确定给定偏移量是否存在于数组中
	 */&lt;/span&gt;
	abstract &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; offsetExists &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$offset&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
	&lt;span style=&quot;color: #009933;&quot;&gt;/**
	 * @param offset 取得给定偏移量上的数据
	 */&lt;/span&gt;
	abstract &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; offsetGet &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$offset&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
	&lt;span style=&quot;color: #009933;&quot;&gt;/**
	 * @param offset 设置或替换给定偏移量上的数据
	 * @param value 要设置或替换的数据
	 */&lt;/span&gt;
	abstract &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; offsetSet &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$offset&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
	&lt;span style=&quot;color: #009933;&quot;&gt;/**
	 * @param offset 置空给定偏移量上的数据
	 */&lt;/span&gt;
	abstract &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; offsetUnset &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$offset&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;具体的实现办法如如下代码所示: 在这个类中我们用到了单件(例)模式.&lt;/h3&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre class=&quot;php&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #009933;&quot;&gt;/**
 * Get options
 *
 * @author yinheli
 *
 */&lt;/span&gt;
&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; PhilNaGetOpt implements ArrayAccess &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
&amp;nbsp;
	&lt;span style=&quot;color: #009933;&quot;&gt;/**
	 * 所有设置
	 *
	 * @var array
	 */&lt;/span&gt;
	&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$philnaOpt&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;array&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
	&lt;span style=&quot;color: #009933;&quot;&gt;/**
	 * 获取设置对象
	 *
	 * @var PhilNaGetOpt
	 */&lt;/span&gt;
	&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$_instance&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
	&lt;span style=&quot;color: #009933;&quot;&gt;/**
	 * 从数据库中取得设置
	 *
	 * @return null
	 */&lt;/span&gt;
	&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; __construct&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
		&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$r&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; get_option&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;'philnaopt'&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
			&lt;span style=&quot;color: #000088;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;philnaOpt&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$r&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
			&lt;span style=&quot;color: #990000;&quot;&gt;unset&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$r&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
		&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
	&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
	&lt;span style=&quot;color: #009933;&quot;&gt;/**
	 * 不许克隆
	 */&lt;/span&gt;
	&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; __clone&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
	&lt;span style=&quot;color: #009933;&quot;&gt;/**
	 * 获取 PhilNaGetOpt 单一实例
	 *
	 * @return PhilNaGetOpt
	 */&lt;/span&gt;
	&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; getInstance&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
		&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;self&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$_instance&lt;/span&gt; instanceof &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;self&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
			&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;self&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$_instance&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;self&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
		&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
		&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;self&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$_instance&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
	&lt;span style=&quot;color: #009933;&quot;&gt;/**
	 * 重新取得设置
	 *
	 * @return null
	 */&lt;/span&gt;
	&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; reGet&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
		&lt;span style=&quot;color: #000088;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;__construct&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
	&lt;span style=&quot;color: #009933;&quot;&gt;/**
	 * 给定的偏移量是否存在?
	 *
	 * @return bool
	 */&lt;/span&gt;
	&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; offsetExists&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$key&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
		&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;array_key_exists&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$key&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;philnaOpt&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
			&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
		&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
			&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
		&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
	&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
	&lt;span style=&quot;color: #009933;&quot;&gt;/**
	 * 返回给定偏移量上的数据
	 *
	 * @return null|mix
	 */&lt;/span&gt;
	&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; offsetGet&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$key&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
		&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;array_key_exists&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$key&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;philnaOpt&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
			&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;is_string&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;philnaOpt&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$key&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
				&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;stripslashes&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;philnaOpt&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$key&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
			&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
				&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;philnaOpt&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$key&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
			&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
		&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
			&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
		&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
	&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
	&lt;span style=&quot;color: #009933;&quot;&gt;/**
	 * 设置给定偏移量上的数据
	 *
	 * @return bool|mix
	 */&lt;/span&gt;
	&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; offsetSet&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$key&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$val&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
		&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;array_key_exists&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$key&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;philnaOpt&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
			&lt;span style=&quot;color: #000088;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;philnaOpt&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$key&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$val&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
			&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$val&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
		&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
			&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
		&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
	&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
&amp;nbsp;
	&lt;span style=&quot;color: #009933;&quot;&gt;/**
	 * 置空给定偏移量上的数据
	 *
	 * @return bool
	 */&lt;/span&gt;
	&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; offsetUnset&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$key&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
		&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;array_key_exists&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$key&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;philnaOpt&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
			&lt;span style=&quot;color: #990000;&quot;&gt;unset&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;philnaOpt&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$key&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
			&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
		&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
			&lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
		&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
	&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;接下来我们我们只需要在代码的最开始时实例化刚刚的那个读取设置的类. 并将它存储到全局数组里. 例如在主题中. 我们可以在 functions.php 文件中首先做这样的事情.&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre class=&quot;php&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$GLOBALS&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;'philnaopt'&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; PhilNaGetOpt&lt;span style=&quot;color: #339933;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;color: #004000;&quot;&gt;getInstance&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;然后我们就不用理会其他的情况, 只需要在你需要的地方调用那个设置对象. 就像是使用数组一样. 而不用不考虑它是否存在着你需要的那个键值. 很多情况下它简化了我们的一些条件判断.&lt;/p&gt;
&lt;h3&gt;比如我们要判断是否需要显示首页通知&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;一般情况下.&lt;/strong&gt; 我们的判断是:&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1
2
3
4
5
6
7
8
9
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre class=&quot;php&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;// 取得设置&lt;/span&gt;
&lt;span style=&quot;color: #000088;&quot;&gt;$opt&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; get_option&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;'philnaopt'&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #666666;&quot;&gt;// 判断是否有通知要显示&lt;/span&gt;
&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;isset&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$opt&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;'notice'&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$opt&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;'notice'&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
	&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;isset&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$opt&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;'notice_content'&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$opt&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;'notice_content'&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
		&lt;span style=&quot;color: #990000;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$opt&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;'notice_content'&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
	&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;而是用&lt;strong&gt;新的办法后&lt;/strong&gt;是这样的:&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1
2
3
4
&lt;/pre&gt;&lt;/td&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre class=&quot;php&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;// 判断并显示通知&lt;/span&gt;
&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000088;&quot;&gt;$GLOBALS&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;'philnaopt'&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;'notice'&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$GLOBALS&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;'philnaopt'&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;'notice_content'&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;
	&lt;span style=&quot;color: #990000;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$GLOBALS&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;'philnaopt'&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;'notice_content'&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;说明:&lt;/em&gt;&lt;br /&gt;
当然在很多人的代码中我经常看不到 isset() 这样的函数. 事实上, 如果在开启报告全部错误的情况下. 我们在判断一个数组中的值. 我们首先要判断是否存在相应的键值. 否则 PHP 会产生一个 NOTICE 级别的错误. 加isset()这样的判断在我看来是一种比较规范的写法.&lt;/p&gt;
&lt;p&gt;使用数组重载来调用设置有一个最大好处是简化判断. 当然更主要的是它规范了代码, 避免了使用 global 这样不优雅的代码.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;注意:&lt;/strong&gt; 这个 PHP 特性只能使用在 PHP 版本 5.1.0 及其以上. 如果你使用古老的版本. 那只能作罢了.&lt;/p&gt;
&lt;h3&gt;Related Posts&lt;/h3&gt;
&lt;ul class=&quot;related_posts&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/04/wordpress-custom-field/&quot; title=&quot;Wordpress custom field之header应用&quot; rel=&quot;bookmark inlinks&quot;&gt;WordPress custom field之header应用&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 25 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/02/php-verification-code/&quot; title=&quot;Php图片验证&quot; rel=&quot;bookmark inlinks&quot;&gt;Php图片验证&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 16 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/04/jqurey-ajax/&quot; title=&quot;Ajax之jQuery&quot; rel=&quot;bookmark inlinks&quot;&gt;Ajax之jQuery&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 33 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/09/use-main-loop-in-wp-theme/&quot; title=&quot;使用主循环设计思路&quot; rel=&quot;bookmark inlinks&quot;&gt;使用主循环设计思路&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 20 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/03/my-exclusive-page/&quot; title=&quot;建立自己的专属页面&quot; rel=&quot;bookmark inlinks&quot;&gt;建立自己的专属页面&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 38 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2008/12/add-ads-without-plugins/&quot; title=&quot;不用插件放广告&quot; rel=&quot;bookmark inlinks&quot;&gt;不用插件放广告&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 12 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/03/my-plugin-ajax-home-page/&quot; title=&quot;我做的插件: Ajax home page&quot; rel=&quot;bookmark inlinks&quot;&gt;我做的插件: Ajax home page&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 71 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/10/cache-avatar/&quot; title=&quot;缓存头像的插件 cache avatar&quot; rel=&quot;bookmark inlinks&quot;&gt;缓存头像的插件 cache avatar&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 33 )&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/400375708/PhilNa/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375708/5391790/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://philna.com/2010/01/use-array-overloading-in-the-wordpress-theme-or-plug-in-settings/feed/</wfw:commentRss><slash:comments>45</slash:comments><description>&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/PhilNa/400375708/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/PhilNa/400375708/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;现在大部分的 WordPress 主题和插件都有后台设置页面, 为主题或插件添加自定义的一些功能. 这些设置会将被保存到数据库中. 然后在主题或插件中使用它们. 通常人们都是用 global 这样的关键字将他们的设置声明为一个全局变量. 或者在各个页面上都使用 get_options 这样的函数去取得设置. 然而我觉得那样处理并不好. 这里我写了个自认为较好的办法. 欢迎大家批评指正. 该方法用到了数组重载. 数组重载是将对象作为数组使用的一个过程. 为了实现这个你需要用到 ArrayAccess 接口. 以下是 ArrayAccess 接口代码清单: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 interface ArrayAccess &amp;#123; &amp;#160; /** * @param offset [...]&lt;img src=&quot;http://www1.feedsky.com/t1/400375708/PhilNa/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375708/5391790/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>Plugin</category><category>theme</category><category>Technology</category><category>WordPress</category><pubDate>Wed, 20 Jan 2010 23:17:42 +0800</pubDate><author>yinheli</author><comments>http://philna.com/2010/01/use-array-overloading-in-the-wordpress-theme-or-plug-in-settings/#comments</comments><guid isPermaLink="false">http://philna.com/2010/01/use-array-overloading-in-the-wordpress-theme-or-plug-in-settings/</guid><dc:creator>yinheli</dc:creator><fs:srclink>http://philna.com/2010/01/use-array-overloading-in-the-wordpress-theme-or-plug-in-settings/</fs:srclink><fs:srcfeed>http://philna.com/feed</fs:srcfeed><fs:itemid>feedsky/PhilNa/~7212539/400375708/5391790</fs:itemid></item><item><title>用 eclipse 写 WordPress 主题和插件</title><link>http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375709/5391790/1/item.html</link><content:encoded>&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/PhilNa/400375709/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/PhilNa/400375709/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;切换到 eclipse 有很长一段时间了. 这里推荐给 WordPress 主题作者和插件开发者, 当然如果你已经在使用或者计划使用其他更为强大的 IDE 开发工具的话可以跳过本文, 因为我这只介绍基本的使用方法, 旨在将大家引入一种更为便捷的开发环境. 当然对于非 WP 使用者而言这种方法同样适用.&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Eclipse是著名的跨平台的自由集成开发环境(&lt;a href=&quot;http://zh.wikipedia.org/zh-cn/集成开发环境&quot; rel=&quot;external nofollow&quot;&gt;IDE&lt;/a&gt;)最初主要用来Java语言开发,但是目前亦有人通过插件使其作为其他计算机语言比如C++和Python的开发工具&amp;#8230; &lt;a href=&quot;http://zh.wikipedia.org/zh-cn/Eclipse&quot; title=&quot;read more&quot; rel=&quot;external nofollow&quot;&gt;More&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;span id=&quot;more-219&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;下载和安装 eclipse&lt;/h2&gt;
&lt;p&gt;Eclipse 有多个版本, 主要是它们集成了不同的插件从而适用不同语言的开发者. 你可以到&lt;a href=&quot;http://www.eclipse.org/downloads/&quot; title=&quot;Get Eclipse&quot; rel=&quot;external nofollow&quot;&gt;这里&lt;/a&gt;下载. &lt;/p&gt;
&lt;p&gt;我使用的编程语言是 PHP 因此下载 Eclipse for PHP Developers 这个版本.&lt;/p&gt;
&lt;p&gt;Eclipse 是绿色软件, 解压即可使用, 当然由于它是基于 Java 的, 你需要 Java 环境. 安装Java环境和设置path, 这些细节不再本文讨论范围. 不会的菜鸟们可以 Google 一下.&lt;/p&gt;
&lt;h2&gt;使用技巧&lt;/h2&gt;
&lt;p&gt;	第一次启动 eclipse 是一个欢迎界面, 关掉欢迎标签后会看到多个透视图. 接下来我们就可以开始使用这个强大的开发工具了.&lt;/p&gt;
&lt;h3&gt;新建工程&lt;/h3&gt;
&lt;p&gt;	点击工具栏左下方按钮或者功过 file(文件) 新建一个 PHP Project&lt;/p&gt;
&lt;p&gt;	给你建的工程起个名字, 注意工程的路径为本地 WordPress 根目录(接下来, 你就会看到这样做的好处), 然后直接点 finish 即可&lt;/p&gt;
&lt;h3&gt;调整字体&lt;/h3&gt;
&lt;p&gt;	默认情况下 eclipse 在 windows 上的字体偏小. 我们需要适当调整一下, 我主要只修改三处&lt;br /&gt;
	&lt;strong&gt;修改步骤:&lt;/strong&gt;&lt;br /&gt;
	点击菜单上的 Window -&gt; Preferences, 在左边的 General 中点开 Apperance -&gt; colors and Fonts&lt;br /&gt;
	&lt;strong&gt;我的设置是:&lt;/strong&gt;&lt;br /&gt;
	Dialog Font 设置为 微软雅黑&lt;br /&gt;
	Text Editor Block Selection Font 和 Text Font 均设置为 Consolas&lt;/p&gt;
&lt;p&gt;	编辑器里面的字体原则上是使用等宽字体. 这样我们比较容易区分数字0和字母o这样比较接近的字符. windows 系统上默认是 Courier New. 我都看腻了. 试用了 Consolas 感觉还不错.&lt;/p&gt;
&lt;p&gt;	不推荐使用一些手写风格的字体, 漂亮的雅黑也最好不用, 我感觉那种字体用来编程看上去让眼睛很累. 网上有很多很漂亮的免费等宽字体下载. 大家可以去试试. 好的字体看上去舒服清晰, 敲代码时也让人心情愉悦些.&lt;/p&gt;
&lt;p&gt;	除了 Consolas 我还推荐的是 Linux 上面的 Mono&lt;/p&gt;
&lt;h3&gt;代码提示和自动完成&lt;/h3&gt;
&lt;p&gt;	这个功能几乎是所有 IDE 都具备的, 给我们的编程提供了非常大的便利.&lt;/p&gt;
&lt;p&gt;	还记得刚刚在建立工程时把整个 WordPress 目录放进去的步骤吧, 就是为这个强大的提示和自动完成服务的.&lt;/p&gt;
&lt;p&gt;	&lt;strong&gt;代码提示&lt;/strong&gt;: 鼠标放到个已经定义的函数上, 它的位置描述等等全部会提示出来. 按住 Ctrl单击那个函数, 我们就直接打开了那个函数所在的文件并自动转到那个函数的位置. 你很方便的查看那个函数具体是怎么编写的.&lt;/p&gt;
&lt;p&gt;	&lt;strong&gt;自动完成&lt;/strong&gt;: 有时候我们记不清到底之前写过的变量或者函数时, 只需要写出那个函数或变量的前几个字符然后按住 alt+? 它会自动为您搜索.&lt;/p&gt;
&lt;h3&gt;常用快捷键&lt;/h3&gt;
&lt;table title=&quot;Eclipse常用快捷键&quot; summary=&quot;Eclipse常用快捷键备忘.记住些常用的快捷键能明显提高我们的工作效率&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;按键&lt;/th&gt;
&lt;th&gt;功能&lt;/th&gt;
&lt;th&gt;按键&lt;/th&gt;
&lt;th&gt;功能&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+S&lt;/td&gt;
&lt;td&gt;保存&lt;/td&gt;
&lt;td&gt;Ctrl+T&lt;/td&gt;
&lt;td&gt;快速显示当前类的继承结构&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+1&lt;/td&gt;
&lt;td&gt;快速修复&lt;/td&gt;
&lt;td&gt;Ctrl+Alt+Down&lt;/td&gt;
&lt;td&gt;复制当前行到下一行&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+D&lt;/td&gt;
&lt;td&gt;删除当前行&lt;/td&gt;
&lt;td&gt;Ctrl+Alt+Up&lt;/td&gt;
&lt;td&gt;复制当前行到上一行&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+W&lt;/td&gt;
&lt;td&gt;关闭当前Editer&lt;/td&gt;
&lt;td&gt;Ctrl+Shift+K&lt;/td&gt;
&lt;td&gt;参照选中的Word快速定位到上一个&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+K&lt;/td&gt;
&lt;td&gt;参照选中的Word快速定位到下一个&lt;/td&gt;
&lt;td&gt;Ctrl+E&lt;/td&gt;
&lt;td&gt;快速显示当前Editer的下拉列表&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+Q &lt;/td&gt;
&lt;td&gt;定位到最后编辑的地方&lt;/td&gt;
&lt;td&gt;Ctrl+Shift+F&lt;/td&gt;
&lt;td&gt;格式化当前代码&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+L&lt;/td&gt;
&lt;td&gt;定位到指定行&lt;/td&gt;
&lt;td&gt;Ctrl+Shift+L&lt;/td&gt;
&lt;td&gt;显示全部定义的快捷键&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+M&lt;/td&gt;
&lt;td&gt;最大(小)化当前的Edit或View&lt;/td&gt;
&lt;td&gt;Alt+Left&lt;/td&gt;
&lt;td&gt;上一个编辑位置&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+Shift+M&lt;/td&gt;
&lt;td&gt;查找函数&lt;/td&gt;
&lt;td&gt;Alt+Right&lt;/td&gt;
&lt;td&gt;下一个编辑位置&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+Shift+T&lt;/td&gt;
&lt;td&gt;查找类&lt;/td&gt;
&lt;td&gt;Alt+/&lt;/td&gt;
&lt;td&gt;内容辅助功能&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+O&lt;/td&gt;
&lt;td&gt;快速显示OutLine&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;	&lt;em&gt;* 不推荐修改原有的快捷键. 记住一些常用的就可以了&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;安装插件&lt;/h2&gt;
&lt;p&gt;	Eclipse 有很多的插件, 但是对于写 WordPress 主题和插件的作者来说我推荐常装的插件是 Aptana. 用它来敲 Javascript 怎一个爽字了得.&lt;/p&gt;
&lt;p&gt;	事实上 Aptana 是个基于 eclipse 开发的 IDE, 同时它也提供一个 eclipse 的插件, 这样装了 Eclipse 的人就没有必要在重新安装一次 Aptana 了, 而只需要安装它提供的插件.&lt;/p&gt;
&lt;p&gt;	你可以选择两种方法来安装 Aptana 插件版. 1, 在线更新. 2, 下载 zip 文件. 你任选择一种即可. 到目前为止. 最新版zip的压缩文件约 35M. 我一般选择的是下载 zip 压缩包. 因为用迅雷下载这玩意很快. 比在线更新要快的多.&lt;/p&gt;
&lt;p&gt;	在线更新请按照 Aptana 提供的步骤来.&lt;/p&gt;
&lt;p&gt;	我简单介绍一下 zip 压缩包格式的安装.&lt;br /&gt;
	点击菜单栏的 Help -&gt; Install New Software&amp;#8230; 在弹出的窗口中点击 add -&gt; Archive&amp;#8230; 选择你下载回来的压缩包. 然后一步一步安装即可.&lt;/p&gt;
&lt;p&gt;	装好这个插件后如果你经常用 javascript 框架写代码的话. 那我建议你安装 Aptana 的相关 Javascript 框架支持. 比如我安装了 jQuery. 我这里不再详细, 不怎么理解的请 Google 一下. 有很多的教程告诉你要这么装.&lt;/p&gt;
&lt;p&gt;	&lt;strong&gt;值得注意的是:&lt;/strong&gt;&lt;br /&gt;
	装好插件后要调整一下文件的打开方式,  Window -&gt; Preferences, General -&gt; Eidtors -&gt; File Associations. 找到 js 后缀. 将 Aptana JS Editor 设置为默认编辑器. 这样你才能用 Aptana 提供的强大提示和自动完成功能. 要不然你会莫名其妙的发现插件安装成功了. 怎么就没有我提到的功能呢? 如果你还安装了其他的什么高级编辑器同样需要这样处理一下. 否则就它是调用 eclipse 默认的编辑器的.&lt;/p&gt;
&lt;h2&gt;后续话题:&lt;/h2&gt;
&lt;p&gt;	代码重构&lt;/p&gt;
&lt;p&gt;	SVN 版本控制&lt;/p&gt;
&lt;h2&gt;类似软件和工具&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Zend Studio&lt;/li&gt;
&lt;li&gt;Aptana&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;后记:&lt;/h2&gt;
&lt;p&gt;请原谅此文没有插图. 不要说无图无真相. 哈. 我是希望你亲自去体验.&lt;/p&gt;
&lt;p&gt;上面提及的两个类似软件都是基于 eclipse 这个开源软件的. 都是一个内核. 不同的只是集成的插件不同. 由不同的公司,社区维护.&lt;/p&gt;
&lt;p&gt;有人说使用 IDE 工具尤其是代码自动完成会造成人的惰性. 嗯. 我也觉得是这样. 其实我们现在流行使用 jQuery 和其他 javascript 框架. 甚至其它任何让人们可以偷懒的工具, 不也是同样的道理吗? 用的多了, 我们是感觉很方便的同时也忘却了很多该记住的东西. 这就跟一个厨师一般不会去关注锅碗瓢盆是怎么制造出来的而只是关注饭菜要怎么才美味一样. 另个可比的情况是: 我们很多人离开了 Dreamweaver 这种所见即所得的编辑工具后给个记事本就完全不会写 HTML 了. 所以如果你希望多了解编程, 还是一定要多去记忆一下东西的. IDE 只是一个便捷的快速的开发环境.&lt;/p&gt;
&lt;p&gt;还有什么问题? 欢迎提交评论, 大家一起讨论.&lt;br /&gt;
&lt;h3&gt;Related Posts&lt;/h3&gt;
&lt;ul class=&quot;related_posts&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2008/10/notepad/&quot; title=&quot;文本编辑Notepad++&quot; rel=&quot;bookmark inlinks&quot;&gt;文本编辑Notepad++&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 4 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2008/11/high-definition-enlarge/&quot; title=&quot;让你高清无码&quot; rel=&quot;bookmark inlinks&quot;&gt;让你高清无码&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 5 )&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/400375709/PhilNa/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375709/5391790/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://philna.com/2010/01/with-the-eclipse-development-of-wordpress-themes-and-plugins/feed/</wfw:commentRss><slash:comments>18</slash:comments><description>&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/PhilNa/400375709/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/PhilNa/400375709/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;切换到 eclipse 有很长一段时间了. 这里推荐给 WordPress 主题作者和插件开发者, 当然如果你已经在使用或者计划使用其他更为强大的 IDE 开发工具的话可以跳过本文, 因为我这只介绍基本的使用方法, 旨在将大家引入一种更为便捷的开发环境. 当然对于非 WP 使用者而言这种方法同样适用. Eclipse是著名的跨平台的自由集成开发环境(IDE)最初主要用来Java语言开发,但是目前亦有人通过插件使其作为其他计算机语言比如C++和Python的开发工具&amp;#8230; More 下载和安装 eclipse Eclipse 有多个版本, 主要是它们集成了不同的插件从而适用不同语言的开发者. 你可以到这里下载. 我使用的编程语言是 PHP 因此下载 Eclipse for PHP Developers 这个版本. Eclipse 是绿色软件, 解压即可使用, 当然由于它是基于 Java 的, 你需要 Java 环境. 安装Java环境和设置path, 这些细节不再本文讨论范围. 不会的菜鸟们可以 Google 一下. 使用技巧 第一次启动 eclipse 是一个欢迎界面, 关掉欢迎标签后会看到多个透视图. 接下来我们就可以开始使用这个强大的开发工具了. 新建工程 点击工具栏左下方按钮或者功过 file(文件) 新建一个 PHP [...]&lt;img src=&quot;http://www1.feedsky.com/t1/400375709/PhilNa/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375709/5391790/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>software</category><category>eclipse</category><category>Soft Secommend</category><pubDate>Tue, 12 Jan 2010 16:10:02 +0800</pubDate><author>yinheli</author><comments>http://philna.com/2010/01/with-the-eclipse-development-of-wordpress-themes-and-plugins/#comments</comments><guid isPermaLink="false">http://philna.com/?p=219</guid><dc:creator>yinheli</dc:creator><fs:srclink>http://philna.com/2010/01/with-the-eclipse-development-of-wordpress-themes-and-plugins/</fs:srclink><fs:srcfeed>http://philna.com/feed</fs:srcfeed><fs:itemid>feedsky/PhilNa/~7212539/400375709/5391790</fs:itemid></item><item><title>阻止直接 POST 过来的 Spam</title><link>http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375710/5391790/1/item.html</link><content:encoded>&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/PhilNa/400375710/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/PhilNa/400375710/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;几天前收到很多 spam, 居然大部分来自同一个 IP. 我只好在数据库里用 SQL 语句删掉. 再去看访问日志. 发现这个 IP 几乎是直接向我的 wp-comments-post.php 这个文件 POST 数据. 也就是说它根本没有访问文章. 我很气愤.&lt;/p&gt;
&lt;p&gt;现在想到的解决方案是用 SESSION 来阻止. 写成插件 &lt;em&gt;( Stop post spam )&lt;/em&gt;. 本地测试有效. 但要是用了 HTML 静态缓存就不知到了. 可能会导致任何人都无法提交? 不过总的来说这个是不适合完全静态页面的, 除非我们的隐藏域设置为固定的值? 这个有恐怕无法到达很好的阻止作用. 两难啊. 唉. 反正我也不用缓存插件. 不管了. 交给爱折腾的人吧.&lt;/p&gt;
&lt;h2&gt;再和大家说说我的流程是怎样的.&lt;/h2&gt;
&lt;p&gt;&lt;span id=&quot;more-218&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;插件激活后通过 StopPOSTSpam 类的构造函数挂载方法到 WordPress 自身的 HOOKs 上. (怎么听上去有点拗口&amp;#8230; (- -!))&lt;/p&gt;
&lt;p&gt;用到的钩子: init, template_redirect, comment_form,  pre_comment_on_post&lt;/p&gt;
&lt;h2&gt;具体实现流程: &lt;/h2&gt;
&lt;p&gt;正常访问状态, 访客访问可以评论的页面(比如普通的日志页面), PHP 执行如下:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;init 会将ready状态设置为 true.&lt;/li&gt;
&lt;li&gt;到执行 template_redirect 的时候判断是否为评论的页面, 是则创建随机 SESSION 否则插件不再执行 Spam 判断&lt;/li&gt;
&lt;li&gt;评论表达中通过 comment_form 这个 hook 添加刚刚创建的 SESSION 隐藏域.&lt;/li&gt;
&lt;li&gt;提交评论的时候通过 pre_comment_on_post 这个 hook 判断 SESSION. 当然 ready 状态为 false 不判断.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;直接POST数据时: 没有通过 template_redirect 这一步来生成 SESSION 当然是不能通过的. 它会被当成 spam 而阻止进一步向数据库提交. &lt;/p&gt;
&lt;p&gt;最后祝大家元旦快乐, 我不想写感悟, 也不想总结. 反正这半年来过的真是不怎么样. 这算是2009最后一个小时的文章吧. 过几天的考试. 唉~ 我可能会死 &amp;#8216;很惨&amp;#8217; . 有时间和爱心的朋友到时候可要过来安慰我啊&amp;#8230;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://code.google.com/p/philna/downloads/list&quot; title=&quot;get WP Plugin Stop post spam&quot;&gt;下载这个插件.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;在无法使用 session 的情况下改为判断来路. 不知是否试用于静态页面. 欢迎测试.&lt;br /&gt;
&lt;h3&gt;Related Posts&lt;/h3&gt;
&lt;ul class=&quot;related_posts&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/09/highlight-keywords/&quot; title=&quot;高亮搜索结果&quot; rel=&quot;bookmark inlinks&quot;&gt;高亮搜索结果&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 20 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2008/12/add-ads-without-plugins/&quot; title=&quot;不用插件放广告&quot; rel=&quot;bookmark inlinks&quot;&gt;不用插件放广告&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 12 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/03/design-404-error-page/&quot; title=&quot;设计404页面&quot; rel=&quot;bookmark inlinks&quot;&gt;设计404页面&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 25 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/04/wordpress-custom-field/&quot; title=&quot;Wordpress custom field之header应用&quot; rel=&quot;bookmark inlinks&quot;&gt;WordPress custom field之header应用&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 25 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/02/get-feed-add-some-personality/&quot; title=&quot;给feed输出内容添加些'个性'&quot; rel=&quot;bookmark inlinks&quot;&gt;给feed输出内容添加些&amp;#8217;个性&amp;#8217;&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 11 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/04/fix-enthusiastic-commentator/&quot; title=&quot;修正热情评论员&quot; rel=&quot;bookmark inlinks&quot;&gt;修正热情评论员&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 17 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/04/contribution-plugin/&quot; title=&quot;简单的Wordpress投稿插件&quot; rel=&quot;bookmark inlinks&quot;&gt;简单的Wordpress投稿插件&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 37 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/03/comment-sms-alert/&quot; title=&quot;评论短信提醒&quot; rel=&quot;bookmark inlinks&quot;&gt;评论短信提醒&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 24 )&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/400375710/PhilNa/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375710/5391790/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://philna.com/2009/12/prevent-the-direct-post-spam/feed/</wfw:commentRss><slash:comments>37</slash:comments><description>&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/PhilNa/400375710/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/PhilNa/400375710/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;几天前收到很多 spam, 居然大部分来自同一个 IP. 我只好在数据库里用 SQL 语句删掉. 再去看访问日志. 发现这个 IP 几乎是直接向我的 wp-comments-post.php 这个文件 POST 数据. 也就是说它根本没有访问文章. 我很气愤. 现在想到的解决方案是用 SESSION 来阻止. 写成插件 ( Stop post spam ). 本地测试有效. 但要是用了 HTML 静态缓存就不知到了. 可能会导致任何人都无法提交? 不过总的来说这个是不适合完全静态页面的, 除非我们的隐藏域设置为固定的值? 这个有恐怕无法到达很好的阻止作用. 两难啊. 唉. 反正我也不用缓存插件. 不管了. 交给爱折腾的人吧. 再和大家说说我的流程是怎样的. 插件激活后通过 StopPOSTSpam 类的构造函数挂载方法到 WordPress 自身的 HOOKs 上. (怎么听上去有点拗口&amp;#8230; (- -!)) 用到的钩子: init, template_redirect, comment_form, pre_comment_on_post [...]&lt;img src=&quot;http://www1.feedsky.com/t1/400375710/PhilNa/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375710/5391790/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>Plugin</category><category>Technology</category><category>comment</category><category>WordPress</category><pubDate>Thu, 31 Dec 2009 22:30:30 +0800</pubDate><author>yinheli</author><comments>http://philna.com/2009/12/prevent-the-direct-post-spam/#comments</comments><guid isPermaLink="false">http://philna.com/2009/12/prevent-the-direct-post-spam/</guid><dc:creator>yinheli</dc:creator><fs:srclink>http://philna.com/2009/12/prevent-the-direct-post-spam/</fs:srclink><fs:srcfeed>http://philna.com/feed</fs:srcfeed><fs:itemid>feedsky/PhilNa/~7212539/400375710/5391790</fs:itemid></item><item><title>Google Ajax Custom Search</title><link>http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375711/5391790/1/item.html</link><content:encoded>&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/PhilNa/400375711/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/PhilNa/400375711/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;好久没有关注 Google 自定义搜索. 今天上去一看很多地方都改掉了. Google 更偏向于使用他的 Ajax API. 好吧, 我也来研究一下. 基本来说文档还是很详尽的.&lt;/p&gt;
&lt;p&gt;做了个小尝试. 利用 Google Ajax API 写了个 Google 自定义搜索. 可以用来搜索本站内容. &lt;/p&gt;
&lt;p&gt;注意: 原则上 Google 要求保留它的 logo. 所以大家在使用的时候还是最后加上. 这也是对 Google 的一种尊重吧.&lt;/p&gt;
&lt;p&gt;我写的&lt;a href=&quot;http://philna.com/tutorials/2009/google_ajax_custom_search/&quot;&gt; DEMO&lt;/a&gt; 在这里.&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-217&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;以后有时间考虑给主题加上吧. 也需要等到下一个主题了. 现在越来越觉的主题主题集成的东西太多. 非常不利于修改和维护. 而且代码也写得不优雅. 重来实在是没有时间.&lt;br /&gt;
&lt;h3&gt;Related Posts&lt;/h3&gt;
&lt;ul class=&quot;related_posts&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/04/learning-ajax-2/&quot; title=&quot;学习Ajax之XMLHttpRequest对象&quot; rel=&quot;bookmark inlinks&quot;&gt;学习Ajax之XMLHttpRequest对象&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 12 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/09/simple-javascript-cache/&quot; title=&quot;基于 javascript 的简单缓存思路&quot; rel=&quot;bookmark inlinks&quot;&gt;基于 javascript 的简单缓存思路&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 3 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2008/10/2001-googl/&quot; title=&quot;看看2001年的Google&quot; rel=&quot;bookmark inlinks&quot;&gt;看看2001年的Google&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 1 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/03/update-comment-in-one-time/&quot; title=&quot;同步更新边侧栏评论&quot; rel=&quot;bookmark inlinks&quot;&gt;同步更新边侧栏评论&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 42 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2008/11/staroffice-google/&quot; title=&quot;StarOffice被Google退了&quot; rel=&quot;bookmark inlinks&quot;&gt;StarOffice被Google退了&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 5 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/04/learning-ajax-1/&quot; title=&quot;学习Ajax第一篇(了解)&quot; rel=&quot;bookmark inlinks&quot;&gt;学习Ajax第一篇(了解)&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 11 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/04/jqurey-ajax/&quot; title=&quot;Ajax之jQuery&quot; rel=&quot;bookmark inlinks&quot;&gt;Ajax之jQuery&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 33 )&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://philna.com/2009/03/my-plugin-ajax-home-page/&quot; title=&quot;我做的插件: Ajax home page&quot; rel=&quot;bookmark inlinks&quot;&gt;我做的插件: Ajax home page&lt;/a&gt;&lt;span class=&quot;count&quot;&gt;( 71 )&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/400375711/PhilNa/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375711/5391790/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://philna.com/2009/11/google-ajax-custom-search/feed/</wfw:commentRss><slash:comments>16</slash:comments><description>&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/PhilNa/400375711/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/PhilNa/400375711/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;好久没有关注 Google 自定义搜索. 今天上去一看很多地方都改掉了. Google 更偏向于使用他的 Ajax API. 好吧, 我也来研究一下. 基本来说文档还是很详尽的. 做了个小尝试. 利用 Google Ajax API 写了个 Google 自定义搜索. 可以用来搜索本站内容. 注意: 原则上 Google 要求保留它的 logo. 所以大家在使用的时候还是最后加上. 这也是对 Google 的一种尊重吧. 我写的 DEMO 在这里. 以后有时间考虑给主题加上吧. 也需要等到下一个主题了. 现在越来越觉的主题主题集成的东西太多. 非常不利于修改和维护. 而且代码也写得不优雅. 重来实在是没有时间. Related Posts 看看2001年的Google( 1 ) 图片里放哪里?( 17 ) StarOffice被Google退了( 5 ) jQuery版ajax comment pager( 19 ) Ajax之jQuery( [...]&lt;img src=&quot;http://www1.feedsky.com/t1/400375711/PhilNa/feedsky/s.gif?r=http://item.feedsky.com/~feedsky/PhilNa/~7212539/400375711/5391790/1/item.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>Google</category><category>Technology</category><category>ajax</category><pubDate>Mon, 30 Nov 2009 08:32:29 +0800</pubDate><author>yinheli</author><comments>http://philna.com/2009/11/google-ajax-custom-search/#comments</comments><guid isPermaLink="false">http://philna.com/2009/11/google-ajax-custom-search/</guid><dc:creator>yinheli</dc:creator><fs:srclink>http://philna.com/2009/11/google-ajax-custom-search/</fs:srclink><fs:srcfeed>http://philna.com/feed</fs:srcfeed><fs:itemid>feedsky/PhilNa/~7212539/400375711/5391790</fs:itemid></item></channel></rss>