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

<channel>
	<title>Wandsea.com &#187; PHP</title>
	<atom:link href="http://wandsea.com/blog/tag/php/feed" rel="self" type="application/rss+xml" />
	<link>http://wandsea.com/blog</link>
	<description>好吧..大家都要加油哦～</description>
	<lastBuildDate>Sat, 31 Jul 2010 13:29:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>一个Twitter签名图片生成脚本</title>
		<link>http://wandsea.com/blog/420.htm</link>
		<comments>http://wandsea.com/blog/420.htm#comments</comments>
		<pubDate>Thu, 20 Aug 2009 01:00:16 +0000</pubDate>
		<dc:creator>Wandsea</dc:creator>
				<category><![CDATA[Program Impossible]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://wandsea.com/blog/?p=420</guid>
		<description><![CDATA[一直都没有找到合适的Twitter签名图片,国外的遇到中文都成了口口,国内以前有过一个,但后来作者好像关闭了服务. 你需要的是一个国外的(别问我为什么)php服务器,支持gd库和curl就可以,完成效果... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>一直都没有找到合适的Twitter签名图片,国外的遇到中文都成了口口,国内以前有过一个,但后来作者好像关闭了服务.</p>
<p>你需要的是一个国外的(别问我为什么)php服务器,支持gd库和curl就可以,完成效果如下:</p>
<blockquote><p><img src="http://wandsea.com/twitter/s1.png" alt="" /></p></blockquote>
<p>用了一个Twitter的php库,很方便,背景图片是用的fanfou的那个作为样本的,头像图片从Twitter获取,下载代码后只需要更改自己的用户名,并上传一个ttf字体文件即可.</p>
<p>把他做成静态的,这样就可以节约许多服务器资源,用cron新建一个任务,半小时curl这个页面一次.</p>
<p>暂且就是这样了,<del datetime="2009-07-09T01:10:44+00:00">贴代码,第一次用Syntax Highlighter这个插件,顺便试一下</del>js载入太多,放弃..</p>
<p>打包下载地址:<a href="http://wandsea.com/down/twitter-sig.tar.gz">http://wandsea.com/down/twitter-sig.tar.gz</a></p>
<hr/><small>Copyright &copy; 2009<br /> 本Blog采用 知识共享署名-非商业性使用-相同方式共享 许可协议进行许可 轉載請署名 <br/> </small>
<a href="http://wandsea.com/blog/420.htm#comments" title="to the comments"><font color="red">加油！已经盖到8楼啦</font></a><small> － 
<a href="http://Wandsea.com/blog/" title="http://Wandsea.com/blog/">去看看我的Blog？</a> － 
<a href="http://wandsea.com/blog/never-forget" title="http://wandsea.com/blog/never-forget">民主歌声献中华 20年</a><br/> </small></p><h3  class="related_post_title">相关日志</h3><ul class="related_post"><li><a href="http://wandsea.com/blog/399.htm" title="WandShare链接分享V0.1">WandShare链接分享V0.1</a> (5)</li><li><a href="http://wandsea.com/blog/397.htm" title="一个&#8221;正在播放&#8221;信息发布器">一个&#8221;正在播放&#8221;信息发布器</a> (4)</li><li><a href="http://wandsea.com/blog/366.htm" title="将你的Feed同步到Twitter＆Fanfou">将你的Feed同步到Twitter＆Fanfou</a> (3)</li><li><a href="http://wandsea.com/blog/253.htm" title="更改Wordpress的默認搜索框">更改Wordpress的默認搜索框</a> (3)</li><li><a href="http://wandsea.com/blog/161.htm" title="Wordpress密碼保護無法使用">Wordpress密碼保護無法使用</a> (9)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://wandsea.com/blog/420.htm/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>一个&quot;正在播放&quot;信息发布器</title>
		<link>http://wandsea.com/blog/397.htm</link>
		<comments>http://wandsea.com/blog/397.htm#comments</comments>
		<pubDate>Sun, 22 Feb 2009 14:15:31 +0000</pubDate>
		<dc:creator>Wandsea</dc:creator>
				<category><![CDATA[Program Impossible]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[网络]]></category>
		<category><![CDATA[脚本]]></category>

		<guid isPermaLink="false">http://wandsea.com/blog/?p=397</guid>
		<description><![CDATA[这名字起得真纠结，Wandsea's"正在播放"信息发布器....... Update 09-02-24: V0.3发布 更新试听功能，去除文字多余符号，使其更为美观 常来的同学也许已经看到了，在我的Widget栏中把8box换成了现在的... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>这名字起得真纠结，Wandsea's"正在播放"信息发布器.......</p>
<p><strong>Update 09-02-24: V0.3发布 更新试听功能，去除文字多余符号，使其更为美观</strong></p>
<p>常来的同学也许已经看到了，在我的Widget栏中把8box换成了现在的正在播放信息发布，这用的就是本文的这个小脚本（应该不能算软件.....－－），耗时不长，也很简单，主要是利用了前几天的一个显示歌词的脚本中的一个函数，自己编一定很困难...开源就是好，能很好地避免重复劳动，呵呵～</p>
<p>首先从系统中读取现在播放的歌曲信息，经过去空格等操作后利用Get方式与密钥一起发送到服务器段的php脚本上，这个php脚本会把传送过来的密钥与自己存储的密钥进行比对，如一致，则去除html标签（防黑）后保存到服务器上的一个文本文件中，之后打开网页时就从此文本文件中读取内容以及文件最后修改时间并显示出来....就这样....很简单...</p>
<p>支持的播放器有Audicious,Rhythmbox(已测试)，mpc,amarok(理论可以)...当然了，Linux下使用</p>
<p>压缩包内一共四个文件，首先修改各个文件中的各个变量（密钥、服务器地址以及文本文件地址），然后把music_add.php传送到服务器端，music_get.php中的内容复制到你所要显示信息的地方，在终端中运行music_sender_main.sh就可以了。</p>
<p>其他还可以定制的有发布格式，更新间隔等等...（废话...都开源的什么还不能改）</p>
<blockquote><p>本软件采取GPL协议发布，用来发送本地正在播放的歌曲名称到服务器上并在页面上显示出来，这个小程序在本地使用Bash+Python，服务器端使用PHP，主要部分参考自UbuntuForum上的歌词显示插件<br />
作者：Wandsea (2009-02-22)<br />
联系方式：Wandsea [at] gmail.com<br />
网站：http://Wandsea.com/<br />
再次感谢开源社区为我提供如此便利的方式来编写程序！</p></blockquote>
<p>下载地址:<a href="http://wandsea.com/down/Wandsea's_Music_Infomation_Sender_V0.3.tar.gz">http://wandsea.com/down/Wandsea's_Music_Infomation_Sender_V0.3.tar.gz</a></p>
<p>欢迎提出修改意见，有修改好的也可以发送给我，呵呵～</p>
<hr/><small>Copyright &copy; 2009<br /> 本Blog采用 知识共享署名-非商业性使用-相同方式共享 许可协议进行许可 轉載請署名 <br/> </small>
<a href="http://wandsea.com/blog/397.htm#comments" title="to the comments"><font color="red">加油！已经盖到4楼啦</font></a><small> － 
<a href="http://Wandsea.com/blog/" title="http://Wandsea.com/blog/">去看看我的Blog？</a> － 
<a href="http://wandsea.com/blog/never-forget" title="http://wandsea.com/blog/never-forget">民主歌声献中华 20年</a><br/> </small></p><h3  class="related_post_title">相关日志</h3><ul class="related_post"><li><a href="http://wandsea.com/blog/399.htm" title="WandShare链接分享V0.1">WandShare链接分享V0.1</a> (5)</li><li><a href="http://wandsea.com/blog/428.htm" title="Ubuntu下给照片批量添加EXIF信息水印">Ubuntu下给照片批量添加EXIF信息水印</a> (8)</li><li><a href="http://wandsea.com/blog/417.htm" title="Ubuntu 9.04 新通知机制 -Notify-send ">Ubuntu 9.04 新通知机制 -Notify-send </a> (1)</li><li><a href="http://wandsea.com/blog/155.htm" title="Php單詞日記&amp;留言簿">Php單詞日記&amp;留言簿</a> (1)</li><li><a href="http://wandsea.com/blog/437.htm" title="上海电信又开始强行插广告了&#8230;">上海电信又开始强行插广告了&#8230;</a> (10)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://wandsea.com/blog/397.htm/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>更改WordPress的默認搜索框</title>
		<link>http://wandsea.com/blog/253.htm</link>
		<comments>http://wandsea.com/blog/253.htm#comments</comments>
		<pubDate>Thu, 07 Aug 2008 12:56:15 +0000</pubDate>
		<dc:creator>Wandsea</dc:creator>
				<category><![CDATA[Program Impossible]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[站务]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[由于不知道為什么的原因，突然感覺原來的模板過于死氣沉沉，但又不想換模板，因為現在的模板已經被我改動了好多，換一個新的模板又要重新改，所以就開始修改原來的模板了。 好廢話= = ... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>由于不知道為什么的原因，突然感覺原來的模板過于死氣沉沉，但又不想換模板，因為現在的模板已經被我改動了好多，換一個新的模板又要重新改，所以就開始修改原來的模板了。</p>
<p>好廢話= =</p>
<p>好吧，懶得重啟電腦，Ubuntu下完成，Gimp功能還算可以，用起來也蠻順手，把原來那些死氣沉沉的Css也用Emacs全部修<img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://wandsea.com/blog/wp-content/uploads/2008/08/qq.jpg" border="0" alt="Google 自定義搜索" width="150" height="312" align="right" />改了一下，就成了現在這個樣子，改名叫 Bright Final3.0 = = ，原來是Dark Final 2.0，由于自己把模板已經改得不像樣了，所以就不提供下載啦，如果你有耐心，E-mail索取或是修改原版主題都可以。</p>
<p>切入正題= =</p>
<p>wordpress默認的搜索是查詢自己的數據庫，只能查找文章，而且速度慢，剛好改主題，搜索框也改一下吧，Google提供的站點搜索服務，突然發現現在可以把搜索結果放在一個iframe里，然后放在自己的網站里，很和諧，哈哈～</p>
<p>我是注冊過Google AdSense的，如果沒有注冊，好像<a href="http://www.google.com/coop/cse/">Google自定義搜索</a>也是可以的，但都需要Google帳號，說說我的吧，Google 搜索廣告，設定好各項參數，會生成兩段代碼，一段是搜索框，我用這段代碼替換了原來Header的搜索，然后把另外一個接受搜索關鍵詞的代碼放在一個<a href="www.wandsea.com/blog/search">新創建的頁面</a>中，順便也在<a href="www.wandsea.com/blog/search">那個頁面</a>中也放了一個搜索框，呵呵，沒超過Google的要求2個，生成的頁面風格和我的Bo很搭的呢～</p>
<p>繼續跑題，寫了一個PHP計數器.<span id="more-253"></span></p>
<blockquote><p>&lt;?php</p>
<p>/***<strong>© 2008 | Wandsea’Blog </strong>All Right Reserved.</p>
<p><a href="http://wandsea.com/">http://wandsea.com/</a></p>
<p>PHP文字計數器V0.1***/<br />
session_start();<br />
$counterFile = "保存文件的地址";<br />
function displayCounter($counterFile) {<br />
$fp = fopen($counterFile,"rw");<br />
$num = fgets($fp,5);</p>
<p>if (!(preg_match("/('Bot|Crawl|Spider|slurp|sohu-search|lycos|robozilla')/", $_SERVER['HTTP_USER_AGENT']))) { //厚道一點，把搜索引擎Bot排除，一個晚上居然有50多個bot流量<br />
if (!(isset($_SESSION["visit"]) &amp;&amp; $_SESSION["visit"] === true)) {</p>
<p>//保證一次瀏覽只增加一次訪問量<br />
$num += 1;<br />
$_SESSION["visit"] = true;<br />
} }<br />
print "---第 "."$num"." 位访问本站的同学，欢迎留言~";<br />
exec( "rm -rf $counterFile");<br />
exec( "echo $num-&gt; $counterFile");<br />
}<br />
if (!file_exists($counterFile)) {<br />
exec( "echo 0 -&gt; $counterFile");<br />
}<br />
displayCounter($counterFile);<br />
?&gt;</p></blockquote>
<p>很簡易，呵呵，能用就行啊～</p>
<p>PS:我新建計數器的基數是589，是我Clicki統計加上被屏蔽的一段時間用的Google統計得出的結果，始自2008-04-02</p>
<hr/><small>Copyright &copy; 2009<br /> 本Blog采用 知识共享署名-非商业性使用-相同方式共享 许可协议进行许可 轉載請署名 <br/> </small>
<a href="http://wandsea.com/blog/253.htm#comments" title="to the comments"><font color="red">加油！已经盖到3楼啦</font></a><small> － 
<a href="http://Wandsea.com/blog/" title="http://Wandsea.com/blog/">去看看我的Blog？</a> － 
<a href="http://wandsea.com/blog/never-forget" title="http://wandsea.com/blog/never-forget">民主歌声献中华 20年</a><br/> </small></p><h3  class="related_post_title">相关日志</h3><ul class="related_post"><li><a href="http://wandsea.com/blog/339.htm" title="Google PR 更新啦！">Google PR 更新啦！</a> (15)</li><li><a href="http://wandsea.com/blog/230.htm" title="神奇的流量">神奇的流量</a> (2)</li><li><a href="http://wandsea.com/blog/420.htm" title="一个Twitter签名图片生成脚本">一个Twitter签名图片生成脚本</a> (8)</li><li><a href="http://wandsea.com/blog/397.htm" title="一个&#8221;正在播放&#8221;信息发布器">一个&#8221;正在播放&#8221;信息发布器</a> (4)</li><li><a href="http://wandsea.com/blog/393.htm" title="解决Feedsky 704解析错误问题">解决Feedsky 704解析错误问题</a> (4)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://wandsea.com/blog/253.htm/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>WordPress密碼保護無法使用</title>
		<link>http://wandsea.com/blog/161.htm</link>
		<comments>http://wandsea.com/blog/161.htm#comments</comments>
		<pubDate>Tue, 15 Jul 2008 17:38:34 +0000</pubDate>
		<dc:creator>Wandsea</dc:creator>
				<category><![CDATA[Program Impossible]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[插件]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[前一段時間，給幾篇文章加上了訪問密碼，然后無論怎么輸入密碼，IE7和火狐都打不開。 然后一狠心，把插件一個個都關閉打開，最終發現原來是首字下沉這個插件造成的問題。 這就好辦了，... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>前一段時間，給幾篇文章加上了訪問密碼，然后無論怎么輸入密碼，IE7和火狐都打不開。</p>
<p>然后一狠心，把插件一個個都關閉打開，最終發現原來是首字下沉這個插件造成的問題。</p>
<p>這就好辦了，打開PHP文件，慢慢修改，如下。</p>
<blockquote><p>function drop_cap ($content) { </p>
<p>&nbsp;&nbsp;&nbsp; global $post;&nbsp;&nbsp; //從這里開始更改</p>
<p>&nbsp;&nbsp;&nbsp; $p = get_post($post-&gt;ID);</p>
<p>&nbsp;&nbsp;&nbsp; if ( !empty($post-&gt;post_password) )&nbsp;&nbsp; // 如果有密碼保護，直接輸出內容&nbsp; </p>
<p>&nbsp;&nbsp;&nbsp; { </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return $content;</p>
<p>&nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp; else</p>
<p>&nbsp;&nbsp;&nbsp; {&nbsp;&nbsp; //到這里結束 ，最后加上一個“}”，完成</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $newContent = explode("&lt;/p&gt;", $content); </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $newContent1 = explode("&lt;p&gt;", $newContent[0]); </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 如果第一个字母不是 &lt;，就进行首字下沉处理，否则就输出原始内容。这样做，是为了避免一些显示问题。 PS：已經考慮到Html代碼了，嘿嘿～</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (substr($newContent1[1],0,1)!='&lt;') { </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $bufContent = "&lt;p class='fp'&gt;".$newContent1[1]."&lt;/p&gt;"; </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for($i = 1; $i &lt; count($newContent); $i ++){ </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $bufContent .= $newContent[$i] . '&lt;/p&gt;'; </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Return the updated markup </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return $bufContent; </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return $content;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp; }</p>
<p>} </p>
</blockquote>
<p>如想省事，請直接下載以下文件。</p>
<p><a href="http://wandsea.com/down/dropcap.rar" target="_blank">Dropcap 修改版</a></p>
<p>下載完解壓放入插件文件夾啟用即可</p>
<hr/><small>Copyright &copy; 2009<br /> 本Blog采用 知识共享署名-非商业性使用-相同方式共享 许可协议进行许可 轉載請署名 <br/> </small>
<a href="http://wandsea.com/blog/161.htm#comments" title="to the comments"><font color="red">加油！已经盖到9楼啦</font></a><small> － 
<a href="http://Wandsea.com/blog/" title="http://Wandsea.com/blog/">去看看我的Blog？</a> － 
<a href="http://wandsea.com/blog/never-forget" title="http://wandsea.com/blog/never-forget">民主歌声献中华 20年</a><br/> </small></p><h3  class="related_post_title">相关日志</h3><ul class="related_post"><li><a href="http://wandsea.com/blog/393.htm" title="解决Feedsky 704解析错误问题">解决Feedsky 704解析错误问题</a> (4)</li><li><a href="http://wandsea.com/blog/420.htm" title="一个Twitter签名图片生成脚本">一个Twitter签名图片生成脚本</a> (8)</li><li><a href="http://wandsea.com/blog/397.htm" title="一个&#8221;正在播放&#8221;信息发布器">一个&#8221;正在播放&#8221;信息发布器</a> (4)</li><li><a href="http://wandsea.com/blog/253.htm" title="更改Wordpress的默認搜索框">更改Wordpress的默認搜索框</a> (3)</li><li><a href="http://wandsea.com/blog/155.htm" title="Php單詞日記&amp;留言簿">Php單詞日記&amp;留言簿</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://wandsea.com/blog/161.htm/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Php單詞日記&amp;留言簿</title>
		<link>http://wandsea.com/blog/155.htm</link>
		<comments>http://wandsea.com/blog/155.htm#comments</comments>
		<pubDate>Sun, 13 Jul 2008 16:44:55 +0000</pubDate>
		<dc:creator>Wandsea</dc:creator>
				<category><![CDATA[Program Impossible]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[单词日记]]></category>
		<category><![CDATA[网络]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[昨天晚上寫那個PHP日記本寫到了快1點，到最后還沒調試成功，早晨起來繼續寫，突然發現 require_once(‘數據庫調用地址)’; 這句代碼原來是應該寫在function函數里的，加進去立刻就好了。 現在... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>昨天晚上寫那個<a href="http://wandsea.com/keywords/">PHP日記本</a>寫到了快1點，到最后還沒調試成功，早晨起來繼續寫，突然發現 require_once(‘數據庫調用地址)’; 這句代碼原來是應該寫在function函數里的，加進去立刻就好了。</p>
<p>現在實現的功能有讀取數據庫內的日期和單詞，每個月在最上方新增一張表格，自動添加側欄書簽，后臺頁面能夠手動添加單詞，更改某一天的單詞～</p>
<p>日記本還有很多地方需要完善的，比如刪除某一天的，而且日記本的登錄程序也沒有寫，現在的添加頁面地址就是一個密碼，哈哈，很偷懶啊～</p>
<p>不過Index頁面還是蠻漂亮的，Wordpress默認模板就是好啊，很簡潔，<a href="http://wandsea.com/contact/">留言簿的網頁</a>也是用這個模板的～</p>
<p>說到留言簿，現在的空間真的很好，fsock()能夠使用了，這樣發郵件就能夠完成了～</p>
<p>好吧，下面貼代碼，根據<a href="http://creativecommons.org/licenses/by-nc-sa/2.5/cn/">知识共享署名-非商业性使用-相同方式共享</a>进行许可～哈哈~由于留言簿借鑒了好多網絡上的代碼，就不貼了～<span id="more-155"></span></p>
<blockquote><p>&lt;?php<br />
function h2($mo,$year)     /*這是輸出年月小標題的函數*/<br />
{<br />
$mo++;$mo--;   /*轉換為整型*/<br />
if ($mo&lt;=9){<br />
echo"&lt;h2&gt;";<br />
echo"&lt;a name='";echo $year; echo "0"; echo $mo; echo"'";<br />
echo "id='" ;echo $year; echo "0"; echo $mo; echo"'&gt;&lt;/a&gt;";<br />
echo $year; echo "-0"; echo $mo ;echo"&lt;/h2&gt;";<br />
}<br />
else<br />
{<br />
echo"&lt;h2&gt;";<br />
echo"&lt;a name='";echo $year; echo $mo; echo"'";<br />
echo "id='" ;echo $year;echo $mo; echo"'&gt;&lt;/a&gt;";<br />
echo $year; echo "-"; echo $mo ;echo"&lt;/h2&gt;";<br />
}<br />
}</p></blockquote>
<blockquote><p>function text($mos,$moe,$year)  /*這是輸出正文的函數,mos從幾月開始輸出moe從幾月結束*/<br />
{<br />
require_once("數據庫地址");    /*和wordpress一樣也需要一個Config.php自己更改*/<br />
$mos++;$mos--;<br />
$moe++;$moe--; /*轉換為整型*/<br />
for ($kk = $moe; $kk &gt;= $mos; $kk--) {    /*$kk為月份*/<br />
h2($kk,$year); /*打印副標題*/<br />
echo "&lt;div align='center'&gt;";<br />
echo " &lt;table width='100%' border='0' bgcolor='#F0F0F0'&gt;";<br />
$k =0;<br />
for ($ii = 1; $ii &lt;= 5; $ii++) {  /*構建表格*/<br />
echo "&lt;tr&gt;";<br />
for ($i = 1; $i &lt;= 7; $i++) {<br />
echo "&lt;td bgcolor='#FF9900'&gt;";echo "&lt;div align='center'&gt;";<br />
if (($k*7+$i)&lt;=31) echo $k*7+$i;<br />
echo "&lt;/div&gt;";echo "&lt;/td&gt;";<br />
}<br />
echo "&lt;/tr&gt;&lt;tr&gt;";<br />
for ($i = 1; $i &lt;= 7; $i++) {<br />
echo "&lt;td bgcolor='#99CCFF'&gt;";<br />
echo "&lt;div align='center'&gt;";<br />
if (($k*7+$i)&lt;=9) {<br />
if ($kk&lt;=9) $datea = $year.'0'.$kk.'0'.($k*7+$i); /*統一格式為8位,便于數據庫查詢*/<br />
if ($kk&gt;9) $datea = $year.$kk.'0'.($k*7+$i);<br />
$colname_getdairy = "-1";<br />
if (isset($datea)) {<br />
$colname_getdairy = (get_magic_quotes_gpc()) ? $datea : addslashes($datea);<br />
}<br />
mysql_select_db($database_dairy, $dairy);<br />
$query_getdairy = sprintf("SELECT * FROM dairy WHERE `date` = %s", $colname_getdairy);<br />
$getdairy = mysql_query($query_getdairy, $dairy) or die(mysql_error());<br />
$row_getdairy = mysql_fetch_assoc($getdairy);<br />
$totalRows_getdairy = mysql_num_rows($getdairy);<br />
echo $row_getdairy['note']; /*數據庫查詢,echo寫出*/</p>
<p>}<br />
if (($k*7+$i)&gt;9 &amp;&amp;($k*7+$i)&lt;=31) {         /*此處分兩種情況,</p></blockquote>
<blockquote><p>也是為了統一格式,寫完以后發覺其實可以把調用單獨寫,能少好多*/<br />
if ($kk&lt;=9) $datea = $year.'0'.$kk.($k*7+$i); /*統一格式為8位,便于數據庫查詢*/<br />
if ($kk&gt;9)    $datea = $year.$kk.($k*7+$i);<br />
$colname_getdairy = "-1";<br />
if (isset($datea)) {<br />
$colname_getdairy = (get_magic_quotes_gpc()) ? $datea : addslashes($datea);<br />
}<br />
mysql_select_db($database_dairy, $dairy);<br />
$query_getdairy = sprintf("SELECT * FROM dairy WHERE `date` = %s", $colname_getdairy);<br />
$getdairy = mysql_query($query_getdairy, $dairy) or die(mysql_error());<br />
$row_getdairy = mysql_fetch_assoc($getdairy);<br />
$totalRows_getdairy = mysql_num_rows($getdairy);<br />
echo $row_getdairy['note']; /*數據庫查詢,echo寫出*/</p></blockquote>
<blockquote><p>}<br />
echo "&lt;/div&gt; &lt;/td&gt;";<br />
}<br />
echo "&lt;tr/&gt;";   $k++;<br />
}<br />
echo  "&lt;/table&gt; &lt;/div&gt;";<br />
}<br />
}<br />
for ($kkk = (date(Y)-2008+1); $kkk &gt;=1 ; $kkk--)<br />
{<br />
if (($kkk+2007)==date(Y)&amp;&amp;(($kkk+2007)&lt;&gt;2008)){text (1,date(m),$kkk+2007);}<br />
elseif  (($kkk+2007)==date(Y)&amp;&amp;(($kkk+2007)==2008)) {text (7,date(m),$kkk+2007);}<br />
elseif (($kkk+2007)&lt;&gt;2008)  {text (1,12,$kkk+2007);}<br />
else {text (7,12,$kkk+2007);}; /*分情況調用以上函數*/<br />
}<br />
?&gt;</p></blockquote>
<p>至此輸出部分的函數寫完,下面是輸入和數據庫連接(太長了，就寫成txt打開吧):</p>
<p>require_once("數據庫地址"); 這個地址就是下面的數據庫連接這個文件的地址。</p>
<blockquote><p>&lt;?php<br />
# FileName="Connection_php_mysql.htm"<br />
# Type="MYSQL"<br />
# HTTP="true"<br />
$hostname_dairy = "localhost";<br />
$database_dairy = "数据表名";<br />
$username_dairy = "用户名";<br />
$password_dairy = "密码";<br />
$dairy = mysql_pconnect($hostname_dairy, $username_dairy, $password_dairy) or trigger_error(mysql_error(),E_USER_ERROR);<br />
?&gt;</p>
<p><a href="http://wandsea.com/keywords/input.txt">http://wandsea.com/keywords/input.txt</a></p></blockquote>
<hr/><small>Copyright &copy; 2009<br /> 本Blog采用 知识共享署名-非商业性使用-相同方式共享 许可协议进行许可 轉載請署名 <br/> </small>
<a href="http://wandsea.com/blog/155.htm#comments" title="to the comments"><font color="red">加油！已经盖到1楼啦</font></a><small> － 
<a href="http://Wandsea.com/blog/" title="http://Wandsea.com/blog/">去看看我的Blog？</a> － 
<a href="http://wandsea.com/blog/never-forget" title="http://wandsea.com/blog/never-forget">民主歌声献中华 20年</a><br/> </small></p><h3  class="related_post_title">相关日志</h3><ul class="related_post"><li><a href="http://wandsea.com/blog/397.htm" title="一个&#8221;正在播放&#8221;信息发布器">一个&#8221;正在播放&#8221;信息发布器</a> (4)</li><li><a href="http://wandsea.com/blog/437.htm" title="上海电信又开始强行插广告了&#8230;">上海电信又开始强行插广告了&#8230;</a> (10)</li><li><a href="http://wandsea.com/blog/420.htm" title="一个Twitter签名图片生成脚本">一个Twitter签名图片生成脚本</a> (8)</li><li><a href="http://wandsea.com/blog/408.htm" title="随机闲聊网站-Omegle.com">随机闲聊网站-Omegle.com</a> (25)</li><li><a href="http://wandsea.com/blog/406.htm" title="新鲜出炉的顶级域 .root">新鲜出炉的顶级域 .root</a> (11)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://wandsea.com/blog/155.htm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
