﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-&lt;maque&gt;&lt;font color=blue&gt;楚 &amp;nbsp; 客&lt;/font&gt;&lt;/maque&gt;-随笔分类-PHP</title><link>http://www.blogjava.net/nayanliu/category/1309.html</link><description>&lt;marquee direction="up" scrollamount=2 height="120" align="right"&gt;
&lt;font color=green&gt;有关PHP,Python,Java,的东东&lt;/font&gt;
&lt;a href="http://a.netbig.com/account/100333"&gt;我的账本&lt;/a&gt;
&lt;/marquee&gt;</description><language>zh-cn</language><lastBuildDate>Fri, 02 Mar 2007 03:30:57 GMT</lastBuildDate><pubDate>Fri, 02 Mar 2007 03:30:57 GMT</pubDate><ttl>60</ttl><item><title>php 5.1 中的时区问题</title><link>http://www.blogjava.net/nayanliu/archive/2006/02/17/31128.html</link><dc:creator>楚客</dc:creator><author>楚客</author><pubDate>Fri, 17 Feb 2006 01:27:00 GMT</pubDate><guid>http://www.blogjava.net/nayanliu/archive/2006/02/17/31128.html</guid><wfw:comment>http://www.blogjava.net/nayanliu/comments/31128.html</wfw:comment><comments>http://www.blogjava.net/nayanliu/archive/2006/02/17/31128.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/nayanliu/comments/commentRss/31128.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/nayanliu/services/trackbacks/31128.html</trackback:ping><description><![CDATA[<FONT size=2>(转自 phpx.net&nbsp;&nbsp; <A href="http://www.phpx.com/pth110355.php">http://www.phpx.com/pth110355.php</A>)<BR><BR>从php5.1.0开始，php.ini里加入了date.timezone这个选项，默认情况下是关闭的<BR><BR>也就是显示的时间（无论用什么php命令）都是格林威治标准时间<BR><BR>和我们的时间（北京时间）差了正好8个小时，有以下3中方法可以恢复正常的时间。<BR><BR>1，最简单的方法就是不要用php5.1以上的版本<BR><BR>2，如果一定要用，而且不能修改php.ini，则需要在关于时间的初始化的语句的<BR>上面加上 date_default_timezone_set (XXX);<BR>cp无此问题<BR><BR>3，一劳永逸，仅限能修改php.ini。打开php.ini查找date.timezone 去掉前面的分号<BR>= 后面加XXX，重启http服务（如apache2或iis等）即可<BR><BR><BR>关于XXX，大陆内地可用的值是：Asia/Chongqing ，Asia/Shanghai ，Asia/Urumqi （依次为重庆，上海，乌鲁木齐）<BR>港台地区可用：Asia/Macao ，Asia/Hong_Kong ，Asia/Taipei （依次为澳门，香港，台北）<BR>还有新加坡：Asia/Singapore<BR>老外好像把北京漏调了<BR>其他可用的值是：Etc/GMT-8 ，Singapore ，Hongkong ，PRC<BR>PRC是什么？PRC是中华人民共和国啊-_-<BR>以上都是我从php官方说明档里整理出来的GMT-8下面的地区，可能会有遗漏<BR>你可以</FONT><A href="http://www.php.net/docs.php上查到更多的地区" target=_blank><FONT color=#22229c size=2>http://www.php.net/docs.php上查到更多的地区</FONT></A><BR><BR><FONT size=2>由于程序最后还是会把地名转为时区来计算，所以当你使用的不是内置的区域的时候，程序将自动使用格林威治标准时间</FONT><img src ="http://www.blogjava.net/nayanliu/aggbug/31128.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/nayanliu/" target="_blank">楚客</a> 2006-02-17 09:27 <a href="http://www.blogjava.net/nayanliu/archive/2006/02/17/31128.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MySQL密码恢复</title><link>http://www.blogjava.net/nayanliu/archive/2005/06/11/5909.html</link><dc:creator>楚客</dc:creator><author>楚客</author><pubDate>Sat, 11 Jun 2005 05:49:00 GMT</pubDate><guid>http://www.blogjava.net/nayanliu/archive/2005/06/11/5909.html</guid><wfw:comment>http://www.blogjava.net/nayanliu/comments/5909.html</wfw:comment><comments>http://www.blogjava.net/nayanliu/archive/2005/06/11/5909.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/nayanliu/comments/commentRss/5909.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/nayanliu/services/trackbacks/5909.html</trackback:ping><description><![CDATA[<FONT size=2><FONT size=1>(流传较广的方法,mysql中文参考手册上的)<BR>1. 向mysqld server 发送kill命令关掉mysqld server(不是 kill -9),存放进程ID的文件通常在MYSQL的数据库所在的目录中。 <BR>killall -TERM mysqld<BR>你必须是UNIX的root用户或者是你所运行的SERVER上的同等用户，才能执行这个操作。 <BR>2. 使用`--skip-grant-tables' 参数来启动 mysqld。 (LINUX下/usr/bin/safe_mysqld --skip-grant-tables , windows下c:\mysql\bin\mysqld --skip-grant-tables)<BR><BR>3. 然后无密码登录到mysqld server ，<BR>&gt;use mysql <BR>&gt;update user set password=password("new_pass") where user="root"; <BR>&gt;flush privileges; <BR>。你也可以这样做：`mysqladmin -h hostname -u user password 'new password''。 <BR><BR>4. 载入权限表： `mysqladmin -h hostname flush-privileges' ，或者使用 SQL 命令`FLUSH PRIVILEGES'。<BR>5.killall -TERM mysqld<BR>6.用新密码登陆<BR></FONT><BR>修正一下：我在Windows下的实际操作如下<BR>1.关闭正在运行的MySQL。<BR>2.打开DOS窗口，转到mysql\bin目录。<BR>3.输入mysqld-nt --skip-grant-tables回车。如果没有出现提示信息，那就对了。<BR>4.再开一个DOS窗口（因为刚才那个DOS窗口已经不能动了），转到mysql\bin目录。<BR>5.输入mysql回车，如果成功，将出现MySQL提示符 &gt;<BR>6. 连接权限数据库&gt;use mysql; (&gt;是本来就有的提示符,别忘了最后的分号)<BR>6.改密码：&gt; update user set password=password("123456") where user="root"; (别忘了最后的分号)<BR>7.刷新权限（必须的步骤）&gt;</FONT><FONT size=2><STRONG>flush privileges;<BR>8.退出 &gt; \q<BR>9</STRONG>.注销系统，再进入，开MySQL，使用用户名root和刚才设置的新密码123456登陆。<BR><BR>据说可以用直接修改user表文件的方法：<BR>关闭MySQL，Windows下打开Mysql\data\mysql，有三个文件user.frm,user.MYD,user.MYI找个知道密码的MySQL，替换相应的这三个文件，如果user表结构没改过，一般也没人去改，替换user.MYD就可以了。<BR>也可以直接编辑user.MYD，找个十六进制编辑器，UltraEdit就有这个功能。关闭MySQL，打开user.MYD。将用户名root后面的八个字符改为565491d704013245，新密码就是123456。或者将它们对应的十六进制数字，（左边那里，一个字符对应两个数字），改为 00 02 02 02 02 02 02 02,这就是空密码，在编辑器右边看到的都是星号*，看起来很象小数点。重开MySQL，输入root和你的新密码。</FONT><img src ="http://www.blogjava.net/nayanliu/aggbug/5909.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/nayanliu/" target="_blank">楚客</a> 2005-06-11 13:49 <a href="http://www.blogjava.net/nayanliu/archive/2005/06/11/5909.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Limbo v1.0.3.6的两个Bugs及解决方法</title><link>http://www.blogjava.net/nayanliu/archive/2005/06/11/5899.html</link><dc:creator>楚客</dc:creator><author>楚客</author><pubDate>Sat, 11 Jun 2005 01:04:00 GMT</pubDate><guid>http://www.blogjava.net/nayanliu/archive/2005/06/11/5899.html</guid><wfw:comment>http://www.blogjava.net/nayanliu/comments/5899.html</wfw:comment><comments>http://www.blogjava.net/nayanliu/archive/2005/06/11/5899.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/nayanliu/comments/commentRss/5899.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/nayanliu/services/trackbacks/5899.html</trackback:ping><description><![CDATA[在使用Limbo v1.0.3.6过程中发现的两个Bugs：<BR>1.前台的翻页Bug，当到达第二页时，显示记录为空白。<BR>开始以为是 Page_Nav() 函数出错了。后来找了很久，发现是MySQL数据库连接类中的SelectLimit() 函数中的错误 /classes/miniadodb.inc.php---91行(MySQL) , 271行(SQLite)<BR>将&nbsp; &nbsp;if ( !$numrows || !$lm_offset )$sql .= " LIMIT";<BR>改为 if ( isset($numrows) || isset($lm_offset) )$sql .= " LIMIT";<BR>(使用MySQL数据库和SQLite数据库会这样,不知文本数据库有没有同样的问题)<BR><BR>2.后台登陆几分钟后就自动注销的问题。<BR>根源就是cookie设置的时间太短。<BR>/classes/class_auth.php---41行<BR>将&nbsp; &nbsp;$etime=60*5;&nbsp; // 5分钟<BR>改为 $etime=60*15;&nbsp; // 15分钟<BR><BR>这两个Bug在新版的 v1.0.3.7中得到改正。<BR><img src ="http://www.blogjava.net/nayanliu/aggbug/5899.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/nayanliu/" target="_blank">楚客</a> 2005-06-11 09:04 <a href="http://www.blogjava.net/nayanliu/archive/2005/06/11/5899.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PHP的计数器程序---解决全部可能遇到的问题</title><link>http://www.blogjava.net/nayanliu/archive/2005/06/04/5551.html</link><dc:creator>楚客</dc:creator><author>楚客</author><pubDate>Sat, 04 Jun 2005 02:21:00 GMT</pubDate><guid>http://www.blogjava.net/nayanliu/archive/2005/06/04/5551.html</guid><wfw:comment>http://www.blogjava.net/nayanliu/comments/5551.html</wfw:comment><comments>http://www.blogjava.net/nayanliu/archive/2005/06/04/5551.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/nayanliu/comments/commentRss/5551.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/nayanliu/services/trackbacks/5551.html</trackback:ping><description><![CDATA[&nbsp; 一般的计数器程序用的执行外部程序函数 exec()，但很多主机空间(包括收费的)拒绝这个危险操作。<BR>我们只好用fread(),fwrite()等文件读写函数，关键在于采用哪种方式fopen()打开文件。试了N次后，证明以下程序是可行，在收费空间上获得验证。<BR><BR>count目录<BR>&nbsp;&nbsp; |---count.php<BR>&nbsp;&nbsp; |---counter.txt<BR>&nbsp;&nbsp; |---0~9的数字GIF图片(0.gif,...,9.gif)<BR>
<DIV style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid">
<DIV><SPAN style="COLOR: #008080">&nbsp;1</SPAN><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">&lt;?</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">&nbsp;2</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008000">/*</SPAN><SPAN style="COLOR: #008000">&nbsp;本文件为count\conut.php&nbsp;</SPAN><SPAN style="COLOR: #008000">*/</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">&nbsp;3</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR></SPAN><SPAN style="COLOR: #008080">&nbsp;4</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>$countfile&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">count/counter.txt</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;5</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR></SPAN><SPAN style="COLOR: #008080">&nbsp;6</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #000000">!</SPAN><SPAN style="COLOR: #000000">file_exists(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">$countfile</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">)){<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;7</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;$fp</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">fopen(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">$countfile</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">w</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;8</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;$num</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;9</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;fputs($fp,$num,</SPAN><SPAN style="COLOR: #000000">8</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">10</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;fclose($fp);<BR></SPAN><SPAN style="COLOR: #008080">11</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}<BR></SPAN><SPAN style="COLOR: #008080">12</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">else</SPAN><SPAN style="COLOR: #000000">{<BR></SPAN><SPAN style="COLOR: #008080">13</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;$fp</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">fopen(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">$countfile</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">rw+</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">14</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;$num</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">fread($fp,</SPAN><SPAN style="COLOR: #000000">8</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">15</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;$num</SPAN><SPAN style="COLOR: #000000">++</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">16</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;rewind($fp);<BR></SPAN><SPAN style="COLOR: #008080">17</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;fputs($fp,$num,</SPAN><SPAN style="COLOR: #000000">8</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">18</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;fclose($fp);<BR></SPAN><SPAN style="COLOR: #008080">19</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}<BR></SPAN><SPAN style="COLOR: #008080">20</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR></SPAN><SPAN style="COLOR: #008080">21</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008000">/*</SPAN><SPAN style="COLOR: #008000">如果不用图片显示数字，请将以下直到&nbsp;?&gt;&nbsp;之前的部分，改为&nbsp;echo&nbsp;&nbsp;"&lt;font&nbsp;color=red&gt;".$num."&lt;/font&gt;";之类</SPAN><SPAN style="COLOR: #008000">*/</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">22</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>$len_str&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;strlen($num);<BR></SPAN><SPAN style="COLOR: #008080">23</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">for</SPAN><SPAN style="COLOR: #000000">($i</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">;$i</SPAN><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">$len_str;$i</SPAN><SPAN style="COLOR: #000000">++</SPAN><SPAN style="COLOR: #000000">){<BR></SPAN><SPAN style="COLOR: #008080">24</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>$numbers_exploded&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;substr($num,$i,</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">);<BR></SPAN><SPAN style="COLOR: #008080">25</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>$output_str&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;$output_str&nbsp;.&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&lt;img&nbsp;src=\</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">count</SPAN><SPAN style="COLOR: #000000">/</SPAN><SPAN style="COLOR: #000000">$numbers_exploded.gif\</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR></SPAN><SPAN style="COLOR: #008080">26</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>}<BR></SPAN><SPAN style="COLOR: #008080">27</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>echo&nbsp;&nbsp;$output_str;<BR></SPAN><SPAN style="COLOR: #008080">28</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">?&gt;</SPAN></DIV></DIV><BR>使用方法：<BR>例如，在count文件夹外面新建一个test.php。其它位置请修改 $countfile路径。<BR>在test.php要显示的地方直接require一下count.php文件(注意路径)。<BR>&lt;br&gt;<BR>&lt;?php <BR>echo "您是第";<BR>require("count/count.php");<BR>echo "位访客";<BR>?&gt;<BR>&lt;br&gt;<BR><BR>强调最后一个问题，请设置counter.txt文件可读写,Windows下文件权限为everyone，Linux下至少为444。网上的文件或Linux下的文件权限设置要使用FTP软件。<img src ="http://www.blogjava.net/nayanliu/aggbug/5551.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/nayanliu/" target="_blank">楚客</a> 2005-06-04 10:21 <a href="http://www.blogjava.net/nayanliu/archive/2005/06/04/5551.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PHP中的date()函数</title><link>http://www.blogjava.net/nayanliu/archive/2005/05/18/4812.html</link><dc:creator>楚客</dc:creator><author>楚客</author><pubDate>Wed, 18 May 2005 15:14:00 GMT</pubDate><guid>http://www.blogjava.net/nayanliu/archive/2005/05/18/4812.html</guid><wfw:comment>http://www.blogjava.net/nayanliu/comments/4812.html</wfw:comment><comments>http://www.blogjava.net/nayanliu/archive/2005/05/18/4812.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/nayanliu/comments/commentRss/4812.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/nayanliu/services/trackbacks/4812.html</trackback:ping><description><![CDATA[<P>函数原形是<BR>&nbsp;&nbsp;&nbsp; string <B class=methodname>date</B> ( string format [, int timestamp] )<BR>返回 format 格式的时间字符串。参数 format 请参见官方文档<A href="http://php.liukang.com/manual/zh/function.date.php">http://php.liukang.com/manual/zh/function.date.php</A>，一般我们用 "Y-m-d" 或者 "Y-m-d H:i:s"。参数 timestamp 是可选的，留空时等同于 time() 。<BR><BR>简单的例子：<BR>&lt;?php<BR>&nbsp;&nbsp;&nbsp; echo date("Y-m-d");&nbsp;&nbsp;&nbsp; //输出：2005-05-18<BR>?&gt;<BR><BR>更复杂有用的例子：(英文档出自php.net)<BR></P>
<DIV style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid">
<DIV><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><STRONG><SPAN style="COLOR: #000000">carlj&nbsp;at&nbsp;vibez&nbsp;dot&nbsp;ca<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">17</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">Jun</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">2003</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">03</SPAN><SPAN style="COLOR: #000000">:</SPAN><SPAN style="COLOR: #000000">28</SPAN></STRONG><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>Why&nbsp;not&nbsp;</SPAN><SPAN style="COLOR: #0000ff">do</SPAN><SPAN style="COLOR: #000000">&nbsp;something&nbsp;like&nbsp;</SPAN><SPAN style="COLOR: #0000ff">this</SPAN><SPAN style="COLOR: #000000">,&nbsp;to&nbsp;find&nbsp;the&nbsp;number&nbsp;of&nbsp;days&nbsp;</SPAN><SPAN style="COLOR: #0000ff">in</SPAN><SPAN style="COLOR: #000000">&nbsp;a&nbsp;month</SPAN><SPAN style="COLOR: #000000">?</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>$monthNum&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;date(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">n</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;or&nbsp;any&nbsp;value&nbsp;from&nbsp;1-12</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">$year&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;date(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">Y</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);&nbsp;</SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">&nbsp;or&nbsp;any&nbsp;value&nbsp;&gt;=&nbsp;1</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">$numDays&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;date(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">t</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,mktime(</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">,$monthNum,</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">,$year))<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>This&nbsp;will&nbsp;tell&nbsp;you&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;there&nbsp;is&nbsp;</SPAN><SPAN style="COLOR: #000000">28</SPAN><SPAN style="COLOR: #000000">-</SPAN><SPAN style="COLOR: #000000">31</SPAN><SPAN style="COLOR: #000000">&nbsp;days&nbsp;</SPAN><SPAN style="COLOR: #0000ff">in</SPAN><SPAN style="COLOR: #000000">&nbsp;a&nbsp;month<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN></DIV></DIV>
<P>可用该方法求某年某月有多少天。<BR><BR>我综合一下，得到的例子：<BR>&lt;?php<BR>&nbsp;echo date("t",mktime(0,0,0,date("5"),1,date("2005")));&nbsp; //输出：31<BR>?&gt;<BR>这不是写程序的好习惯，我们应当把它写成一个函数，以备将来用。</P>
<DIV style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid">
<DIV><SPAN style="COLOR: #008080">&nbsp;1</SPAN><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">&lt;?</SPAN><SPAN style="COLOR: #000000">php<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;2</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">求&nbsp;$y&nbsp;年&nbsp;$m&nbsp;月有多少天的函数</SPAN><SPAN style="COLOR: #008000"><BR></SPAN><SPAN style="COLOR: #008080">&nbsp;3</SPAN><SPAN style="COLOR: #008000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">function</SPAN><SPAN style="COLOR: #000000">&nbsp;days_in_a_month($y,$m)<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;4</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>{<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;5</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">($year</SPAN><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">1901</SPAN><SPAN style="COLOR: #000000">&nbsp;or&nbsp;$year</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000">2038</SPAN><SPAN style="COLOR: #000000">)<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;6</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: #008000">//超出了PHP的时间范围</SPAN><SPAN style="COLOR: #008000"><BR></SPAN></SPAN><SPAN style="COLOR: #008080">&nbsp;7</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">else</SPAN><SPAN style="COLOR: #000000">&nbsp;&nbsp;{<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;8</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$mon</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">date($m);<BR></SPAN><SPAN style="COLOR: #008080">&nbsp;9</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$year</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">date($y);<BR></SPAN><SPAN style="COLOR: #008080">10</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$mkt</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">mktime(</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">0</SPAN><SPAN style="COLOR: #000000">,$mon,</SPAN><SPAN style="COLOR: #000000">1</SPAN><SPAN style="COLOR: #000000">,$year);<BR></SPAN><SPAN style="COLOR: #008080">11</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff">return</SPAN><SPAN style="COLOR: #000000">&nbsp;date(</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">t</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">,$mkt);<BR></SPAN><SPAN style="COLOR: #008080">12</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR></SPAN><SPAN style="COLOR: #008080">13</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top>}<BR></SPAN><SPAN style="COLOR: #008080">14</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">?&gt;</SPAN><SPAN style="COLOR: #000000"><BR></SPAN><SPAN style="COLOR: #008080">15</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN></DIV></DIV>
<P>有趣的是，我发现月份其实可以填大于12的数字，象下面这样：<BR>&lt;?php<BR>echo&nbsp; days_in_a_month(2003,14);&nbsp; //输出：29<BR>?&gt;<BR>你知道，14月就是来年的2月。</P><img src ="http://www.blogjava.net/nayanliu/aggbug/4812.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/nayanliu/" target="_blank">楚客</a> 2005-05-18 23:14 <a href="http://www.blogjava.net/nayanliu/archive/2005/05/18/4812.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>打造目前功能最全最棒的Mambo</title><link>http://www.blogjava.net/nayanliu/archive/2005/05/16/4309.html</link><dc:creator>楚客</dc:creator><author>楚客</author><pubDate>Mon, 16 May 2005 02:54:00 GMT</pubDate><guid>http://www.blogjava.net/nayanliu/archive/2005/05/16/4309.html</guid><wfw:comment>http://www.blogjava.net/nayanliu/comments/4309.html</wfw:comment><comments>http://www.blogjava.net/nayanliu/archive/2005/05/16/4309.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/nayanliu/comments/commentRss/4309.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/nayanliu/services/trackbacks/4309.html</trackback:ping><description><![CDATA[<P>Mambo4.5.2已有简体中文版，但Mambo功能最丰富的Mambo－phpShop1.2却还是英文版，还有安装不成功的问题。<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 我们可以稍加改造，做个顺手的Mambo：集成phpShop，前后台都是简体中文，并能自动生成静态页面。<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 先去mambochina.com下载“Mambo4.5.2简体中文黄金版”并安装好。再去mambo.cn下载“Mambo4.5.2集成mambo－phpShop1.2英文版”也安装好。接下来替换文件：黄金版/language/&nbsp;－&gt;英文版/language/&nbsp;；黄金版/administrator/&nbsp; －&gt;英文版/administrator/(compents/com_phpshop/除外)；把后台－全局配置－语言中的en_GB改为zh_CN,这样phpShop就变成中文版。什么，首页名称之类没变，还是Home？哥哥，麻烦您去数据库改！<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;最后一道工序，去mambo.cn下载老马的MamboHTML，照其中的说明做生成静态页面。<BR>&nbsp;&nbsp;&nbsp;&nbsp; 打完收功！<BR>&nbsp;&nbsp;&nbsp;&nbsp; </P><img src ="http://www.blogjava.net/nayanliu/aggbug/4309.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/nayanliu/" target="_blank">楚客</a> 2005-05-16 10:54 <a href="http://www.blogjava.net/nayanliu/archive/2005/05/16/4309.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>