<?xml version="1.0" encoding="UTF-8"?>
  <feed xmlns="http://www.w3.org/2005/Atom">
  <title type="html"><![CDATA[hyperblue's Blog]]></title>
  <subtitle type="html"><![CDATA[如有恒，何须三更起，半夜眠！]]></subtitle>
  <id>http://www.kushu.net/</id>
  <link rel="alternate" type="text/html" href="http://www.kushu.net/" /> 
  <link rel="self" type="application/atom+xml" href="http://www.kushu.net/atom.asp" /> 
  <generator uri="http://www.pjhome.net/" version="2.8">PJBlog3</generator> 
  <updated>2010-01-23T09:24:13+08:00</updated>

  <entry>
	  <title type="html"><![CDATA[LAMP环境配置 详细命令过程]]></title>
	  <author>
		 <name>hyperblue</name>
		 <uri>http://www.kushu.net/</uri>
		 <email>hyperblue@163.com</email>
	  </author>
	  <category term="" scheme="http://www.kushu.net/default.asp?cateID=6" label="PHP" /> 
	  <updated>2010-01-23T09:24:13+08:00</updated>
	  <published>2010-01-23T09:24:13+08:00</published>
		  <summary type="html"><![CDATA[以下是笔者初装VMware虚拟机以来，对其安装步骤和使用的一点总结，以给初学者指个方向，少走弯路。<br/><br/>1.下载VMware&nbsp;&nbsp;<br/>官网查看最新版本： <a href="http://www.vmware.com/download/ws/" target="_blank" rel="external">http://www.vmware.com/download/ws/</a><br/>未来软件园下载页： <a href="http://www.orsoon.com/soft/search.asp?keyword=VMware" target="_blank" rel="external">http://www.orsoon.com/soft/search.asp?keyword=VMware</a>&amp;act=topic&amp;x=17&amp;y=18<br/>绿盟VMware下载页：<a href="http://www.xdowns.com/tag.asp?keyword=VMware+Workstation+" target="_blank" rel="external">http://www.xdowns.com/tag.asp?keyword=VMware+Workstation+</a>&amp;act=Topic&amp;classid=&amp;btn.x=29&amp;btn.y=16<br/>七喜下载站下载页：&nbsp;&nbsp;<a href="http://www.baidu.com/s?tn=baitu_pg" target="_blank" rel="external">http://www.baidu.com/s?tn=baitu_pg</a>&amp;ie=gb2312&amp;bs=%3F+site%3Ays168.com&amp;sr=&amp;z=&amp;cl=3&amp;f=8&amp;wd=VMware++site%3Awww.7xdown.com&amp;ct=0<br/>东东在用VMware Workstation 6.0.2 59824完美汉化绿色精简版： 微软网盘本地下载（支持迅雷）&nbsp;&nbsp;&nbsp;&nbsp;新浪共享下载 <br/><br/>2.安装VMware <br/>&nbsp;&nbsp;&nbsp;&nbsp; 安装版基本点NEXT一路安装下去，非常简单，若弹出没有经过Windows兼容性验证提示没有关系，请继续安装，装完后或许还要运行汉化包或注册机或把“汉化文件”里的文件复制到安装目录下覆盖原文件，这些需根据你下载的版本而定，学会看说明就好了。绿色的免安装，只需运行&#34;@install.cmd”或&#34;安装.bat &#34;或&#34;!)绿化.bat&#34;等。添加服务可以以后网络设置时再做，也可参看下文6中内容，如想实现主机和虚拟机同时上网，则即刻添加服务3。发送主程序vmware.exe的快捷方式到桌面上，方便日后使用。<br/><br/>3.新建虚拟机<br/>&nbsp;&nbsp;&nbsp;&nbsp; 运行vmware.exe--新建虚拟机--在虚拟机向导中点“下一步”--选典型--选操作系统（版本）--虚拟机名称位置--选“桥接”或“NAT”网络（见下文6）--默认磁盘容量--完成<br/><br/>4.安装虚拟操作系统<br/>&nbsp;&nbsp;&nbsp;&nbsp; 启动虚拟机前，先在虚拟设备窗口设置虚拟机内存和CD-ROM，你的内存足够大可设为接近物理内存的一半或推荐默认值，设置&#34;CD-ROM&#34;，根据你现在是否有安装光盘或下载的ISO镜像系统来选择“物理光驱”或是“iso镜像”，如果你有一张系统光盘请选择“使用物理驱动器”并把光盘放入光驱，如果你有一个已下载好的ISO镜像系统，请选则“使用ISO镜像”并浏览到此镜像“打开”，最后要点OK确认 。启动虚拟机时要在VMware窗口内快速用鼠标点击一下就能激活VMware操作了，将鼠标键盘从虚拟机操作环境切回到物理机，需要按下Ctrl+Alt键。安装虚拟系统像真实安装一样，也要先进行BIOS设置，启动系统时，按屏幕下方提示快速按F2键可进行虚拟机的Phoenix BIOS设置，用光标键依次选择到Boot— CD-ROM Drive，按Shift+&#34;+&#34;键2次，使其变为首行，再按F10保存退出，就设置好CD-ROM首启动了（另外了解一下：按F12键是选择网络启动；按ESC键是选择启动菜单、且仅此次使用此设置）。接下来进行分区和格式化，可用安装版Windows光盘或镜像在安装系统时进行（这个有点麻烦哦，建议先只分个主分区，装完系统后再分更方便），也可用下载的Ghost版系统里的工具在安装系统前进行，一般多数系统光盘启动菜单下都有PQ等分区工具，Dos工具箱里还有更多分区工具，如FDISK、PartitionMagic（PQ）、DM、DiskGenius、Partition Manager（PM）等，用这些工具分区后不要忘记激活主分区，否则首装Ghost系统后无法成功引导。ghost版操作系统安装简单，一般启动系统后，选择第一项就自动安装了，一般是无人值守的自动安装；安装原版操作系统，启动时，当弹出Press any key to boot form CD... 要在虚拟机窗口内点击一下激活键盘后，再按任意键才有效，然后就能正常安装了。<br/>提示：<br/>&nbsp;&nbsp;&nbsp;&nbsp;① 若用PQ或PM分区，不要忘了激活主分区，好多人安装ghost版系统首次不能成功就在于此。在PQ中，右击主分区C:—进阶—设置为作用—执行—确定，成功激活C:后，C:的&#34;状态&#34;会由“无”设置成“作用”。同样，若用PM分区，也要将C:的“设置活动&#34;由“否”设置为“是”，否则首次安装Ghost版系统后将无法引导。笔者用PM分区时，还遇到过另个问题，装完ghost版系统后却不能成功启动（左上角只有一个不动的光标），尝试利用dos工具箱中的DISKGEN修复好的，利用其“工具”菜单下的“修复主引导记录”来修复，你若也遇到此麻烦也可如此试试。<br/>&nbsp;&nbsp;&nbsp;&nbsp; ② 安装虚拟系统时或装完虚拟系统后的任何时侯，随时可进行镜像“快照”，以后测试时就能快速回到以前快照的位置，以方便回到需要的测试环境，这个功能为测试系统或软件极为方便。<br/>&nbsp;&nbsp;&nbsp;&nbsp;③若出现输入序列号注册的提示，是因你开始没有运行&#34;安装.bat&#34;就启动了虚拟机造成的。解决方法：关闭并退出虚拟机--重启主机--运行&#34;卸载.bat&#34;--运行&#34;安装.bat&#34;--安装必要的服务（一般选1或3）--退出--启动虚拟机。<br/><br/>5.安装VMware Tools （VMware工具可以认为是虚拟操作系统的驱动）<br/>&nbsp;&nbsp;&nbsp;&nbsp; 运行已经安装好的虚拟操作系统，同时按Ctrl+Alt键，将鼠标键盘从虚拟机操作环境切回到物理机，在VMware窗口菜单--点“虚拟机”--“安装VMware工具” --默认设置下一路NEXT完成安装，装完VMware工具后可明显提高显示效果和鼠标效能，还可以在宿主机和虚拟机之间用拖动复制文件了。注意，或许有的绿色版不能自动运行“安装VMware工具”，在虚拟机中，打开“我的电脑”看看“VMware工具”是否以加载到了虚拟光驱设备中了，如果有双击运行就好了。如果没有，设置虚拟设备&#34;CD-ROM&#34;是“iso镜像”，浏览到解压文件夹中的“windows.iso”，再次进入虚拟系统，再打开“我的电脑”，看到虚拟机的光驱驱动器多出来个“VMware工具”，然后运行之就可以安装VMware Tools了，如果还不能看到这个“VMware工具”驱动器，重启虚拟机试试，或直接解压“windows.iso”并运行里面的setup.exe安装，然后重启虚拟机就好了。<br/><br/>6. VMware网络设置：<br/>以笔者的绿色精简版VMware6.0.2单机ADSL宽带拨号上网为例<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;①桥接网络：可实现在虚拟机或宿主机任其一上网。如果安装时没有选择“桥接”，请在虚拟机设备“以太网”网络连接中选择“桥接”，然后运行安装文件夹中的&#34;服务.cmd&#34;（有的绿色版中叫&#34;server.bat），只需运行第一个“启动-本机网络服务”，然后在虚拟机中建立一个与宿主机同样的用户名和密码的“宽带连接”，不需要其他别的设置了，主机和虚拟机TCP/IP属性设置就用默认的自动获得就好了，以后即可用虚拟机或宿主机其一上网了，但二者只能用其一上网。<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;②NAT网络：可实现主机和虚拟机同时共享上网。如果安装时没有选择“NAT&#34;网络模式，请在虚拟机设备“以太网”网络连接中选择“NAT”，然后运行安装文件夹中的&#34;启动服务.cmd”，运行第3个---“DHCP和NAT服务-共享上网”，弹出没有经过Windows兼容性验证提示，请点“仍然继续”并多等会儿。装完后到虚拟机窗口点“编辑”---“虚拟网络设备”，在“虚拟网络编辑器”窗口中分别启动“DHCP”和“NAT”服务就好了，虚拟机里不用建立“宽带连接”，主机和虚拟机也不用再进行其他的网络设置了，重启虚拟机，主机宽带连接后，虚拟机里直接运行IE浏览器就可以上网了。<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;如果物理机是路由共享上网的，在虚拟机里选“桥接”并安装桥接服务（第一项），就能跟主机同时共享上网了。<br/>&nbsp;&nbsp;&nbsp;&nbsp; 了解：有的版本启动宿主机后首次进入虚拟机还要右击右下“网卡图标”选“连接”，才可上网。还有，有的精简版VM 或许不能使用其“虚拟网络设置”，所以只能使用“桥接”上网，东东提供的版本可以实现主机和虚拟机同时共享上网。<br/><br/>7。共享文件夹设置：<br/>&nbsp;&nbsp;&nbsp;&nbsp; 据说虚拟机中的“共享”在windows系统中存在漏洞，因为除了测试电脑安全外，虚拟机里很少装杀毒软件的，黑客会利用这个共享文件夹漏洞穿透虚拟机，VMware官方也承认了，还是不用的好，主机和虚拟机之间能相互复制文件也够用了，想学的百度搜搜吧。<br/><br/>8..卸载VMware<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;绿色版：关掉虚拟机电源，在虚拟机左栏列表中右击，选则“在磁盘中删除”（此步也可退出虚拟机，手动按虚拟机保存路径删除整个虚拟机文件夹），最后运行&#34;@Uninst.cmd”或&#34;!)卸载.bat&#34;，然后删除安装文件夹；<br/>&nbsp;&nbsp;&nbsp;&nbsp; 安装版：关掉虚拟机电源，在虚拟机左栏列表中右击，选则“在磁盘中删除”，再到控制面板--“添加删除”中正常卸载虚拟机软件。<br/><br/><br/><br/><br/>1. 终端 <br/>2. 输入命令 cd /usr/ 回车<br/>进入libxml2源码所在目录<br/>3. 执行 tar -zxvf libxml2-2.6.11.tar.gz<br/>解压libxml2源码.<br/>4. 系统自动列出各解压项.<br/>小提示:解压完成后可以执行 clear 命令清屏<br/>5. 执行 cd libxml2-2.6.11<br/>进入解压出来的目录<br/>6. 执行 ./configure<br/>7. 执行 make <br/>编译源码.<br/>8. 执行 make install<br/>安装libxml2<br/><br/>安装MySQL<br/><br/>1. 执行 cd /home<br/>去到mysql源码所在目录.<br/>执行 ls -l <br/>可以列出当前目录的文件列表.<br/>2. 执行 groupadd mysql新建MYSQL用户<br/>3. 执行 useradd -g mysql mysql 并加到组里<br/>4. 执行 tar -zxvf mysql-5.0.18.tar.gz 解压mysql源码<br/>5. 执行 cd mysql-5.0.18 进入刚解压出来的目录<br/>6. 执行./configure --prefix=/server/mysql --with-xcharset=all --with-charset=gbk<br/>....设置安装目录并支持中文要好久的我就跳过了。。<br/>7. 执行 make 编译源码要好几分钟虚拟机更久。。。跳过。。<br/>8. 执行 make install 编译并安装<br/>9. 执行 /server/mysql/bin/mysql_install_db --user=mysql<br/>10. 执行 cp support-files/my-medium.cnf /etc/my.cnf<br/>将mysql配置文档复制到/etc/目录下并保存为my.cnf<br/>11. 执行 cp support-files/mysql.server /etc/rc.d/init.d/mysqld<br/>12. 执行 chmod 700 /etc/rc.d/init.d/mysqld<br/>13. 执行 chkconfig --add mysqld<br/>14. 执行 cd /server/mysql<br/>进入mysql安装目录.<br/>并执行 chown -R root .<br/>注意:不要漏了后面的 &#34;.&#34;.<br/>15. 执行 chown -R mysql var<br/>16. 执行 chgrp -R mysql .<br/>不要漏掉&#34;.&#34;.<br/>&nbsp;&nbsp;&nbsp;&nbsp;#权限设置<br/>&nbsp;&nbsp;&nbsp;&nbsp;# chown -R root /server/mysql<br/>&nbsp;&nbsp;&nbsp;&nbsp;# chgrp -R mysql /server/mysql<br/>&nbsp;&nbsp;&nbsp;&nbsp;# chown -R root /server/mysql/bin<br/>&nbsp;&nbsp;&nbsp;&nbsp;# chgrp -R mysql /server/mysql/bin<br/>&nbsp;&nbsp;&nbsp;&nbsp;# chown -R root /server/mysql/var/<br/>&nbsp;&nbsp;&nbsp;&nbsp;# chgrp -R mysql /server/mysql/var/<br/>&nbsp;&nbsp;&nbsp;&nbsp;# chmod 777 /server/mysql/var/<br/>&nbsp;&nbsp;&nbsp;&nbsp;# chown -R root /server/mysql/var/mysql<br/>&nbsp;&nbsp;&nbsp;&nbsp;# chgrp -R mysql /server/mysql/var/mysql<br/>&nbsp;&nbsp;&nbsp;&nbsp;# chmod 777 /server/mysql/var/mysql<br/>&nbsp;&nbsp;&nbsp;&nbsp;# chown -R root /server/mysql/var/mysql/*<br/>&nbsp;&nbsp;&nbsp;&nbsp;# chgrp -R mysql /server/mysql/var/mysql/*<br/>&nbsp;&nbsp;&nbsp;&nbsp;# chmod 777 /server/mysql/var/mysql/*<br/>&nbsp;&nbsp;&nbsp;&nbsp;# chmod 777 /server/mysql/lib/mysql/libmysqlclient.a<br/>执行 /server/mysql/bin/mysqld_safe --user=mysql &amp;<br/>启动mysql.<br/>18. 在出现 mysqld ended 的时候.点击回车.回到命令行<br/>&nbsp;&nbsp;# netstat -atln<br/>&nbsp;&nbsp;看看有没有3306的端口打开,如果mysqld不能启动,看看/server/mysql/var下的出错日志,一般都是目录权限没有设置好的问题<br/>&nbsp;&nbsp;# ln -s /server/mysql/bin/mysql /sbin/mysql<br/>&nbsp;&nbsp;# ln -s /server/mysql/bin/mysqladmin /sbin/mysqladmin<br/>&nbsp;&nbsp;# mysqladmin -uroot password &#34;13145200&#34; #设置root帐户的密码我就先不设置了。。。<br/>&nbsp;&nbsp;# mysql -uroot -p<br/>&nbsp;&nbsp;# 输入你设置的密码<br/>&nbsp;&nbsp;mysql&gt;use mysql;<br/>&nbsp;&nbsp;mysql&gt;del&#101;te from user wh&#101;re password=&#34;&#34;; #删除用于本机匿名连接的空密码帐号<br/>&nbsp;&nbsp;mysql&gt;flush privileges;<br/>&nbsp;&nbsp;mysql&gt;quit<br/>MYSQL到这里就装好了。。。<br/>安装Apache<br/><br/>1. 执行 cd /home<br/>回到apache源码所在目录.<br/>2. 执行 tar -zxvf httpd-2.2.4.tar.gz<br/>3. 执行 cd httpd-2.2.4可能是版本问题。。<br/>4. 执行 ./configure --prefix=/server/apache --enable-so<br/>5. 执行 make<br/>6. 执行 make install<br/>7. 执行 /server/apache/bin/apachectl start 启动apache.<br/><br/>安装php<br/><br/>1. 执行 cd /home<br/>回到php源码所在目录.<br/>2. 执行 tar -zxvf php-5.2.1.tar.gz<br/>3. 执行 cd php-5.2.1<br/>4. 执行 ./configure --prefix=/server/php --with-mysql=/server/mysql --with-apxs2=/server/apache/bin/apxs<br/>5. 执行 make<br/>6. 执行 make install<br/>7. 执行 cp php.ini-dist /usr/local/lib/php.ini<br/>配置Apache关联php<br/>1. 执行 vi /server/apache/conf/httpd.conf<br/>用vi编辑器打开apache的配置文件.<br/>2.进入的是vi的命令行方式.<br/>3. 输入 /LoadModule <br/>然后点击 回车<br/>其中/LoadModule 是向下查找 LoadModule.?LoadModule是向上查找<br/>4. 我们可以看到 LoadModule php5_module modules/libphp5.so<br/>这是我们安装时设置好的.但也务必检查一下.我的是正确的了<br/>5. 输入 /AddType<br/>6. 我们可以看到 AddType application/x-gzip .tgz<br/>7. 点击 i 进入 插入编辑方式<br/>右下角会出现插入字样.<br/>8. 将光标移到AddType application/x-gzip .tgz后面.回车后加入一行<br/>AddType application/x-httpd-php .php<br/>9. 点击 Esc 键.回到vi命令行方式.<br/>并输入 /DirectoryIndex<br/>10. 点击 i 键进入 插入编辑方式.并且在 DirectoryIndex index.html<br/>后面加一空格再加index.php<br/>11. 点击 Esc 键.回到vi命令行方式.<br/>输入 :wq&nbsp;&nbsp;然后点击回车<br/>其中 :wq 是存盘退出的命令<br/><br/>安装ZendOptimizer<br/><br/>1. 执行 cd /home<br/>回到 ZendOptimizer 源码所在目录.<br/>2. 执行 tar -zxvf ZendOptimizer-3.2.6-linux-glibc21-i386.tar.gz<br/>3. 执行 cd ZendOptimizer-3.2.6-linux-glibc21-i386<br/>4. 执行 ./install<br/>5. 进入如下的ZendOptimizer安装界面.点击回车<br/>6. 点击回车<br/>7. 在 Yes 上点击回车<br/>8. 这里填写ZendOptimizer安装路径.我们将它安装在 /server/ZendOptimizer<br/>下.填写 /server/ZendOptimizer 后点击 Tab 键.在 ok 上面点击回车<br/>9. 这里选择php.ini所在位置.我们在之前的安装中已经将php.ini复制到了/usr/local/lib<br/>下.所以这里不用修改.在 OK 上点击回车<br/>10. 我们用的正是apache.在Yes上点击回车<br/>11. 这里填写apachectl的位置.我们的是在/server/apache/bin/apachectl<br/>输入 /server/apache/bin/apachectl 后,点击 Tab 键移动光标到 OK 上.然后点击回车<br/>12. 点击回车<br/>13. 点击回车<br/>14. 点击回车 重启apache<br/>15. 点击回车 完成ZendOptimizer的安装<br/>环境测试<br/><br/>安装完成后.我们来测试一下之前配置的环境是否正确<br/><br/>1. 再次重启apache.执行 /server/apache/bin/apachectl -k restart<br/><br/>尽管安装ZendOptimizer时已经重启了apache,但我们还是要执行如下命令重启apache<br/>以确保apache修改的配置已经从新加载入来.请大家务必不要漏了这一步.<br/>2. 执行 vi /server/apache/htdocs/phpinfo.php<br/>在网站根目录下建立一个phpinfo.php的文件.<br/>3. 点击 i 键进入 插入编辑方式.<br/>4. 输入<br/>&lt;?php<br/>phpinfo();<br/>?&gt;<br/>5. 点击 Esc 键回到vi 命令行方式.输入 :wq 回车<br/>系统将保存phpinfo.php文件,并退出vi编辑器<br/>6. 在浏览器打开 <a href="http://192.168.6.33/phpinfo.php" target="_blank" rel="external">http://192.168.6.33/phpinfo.php</a><br/>如果出现如下界面则说明php已经安装好了.<br/>7. 测试 php 是否和 mysql 关联.<br/>执行 vi /server/apache/htdocs/test.php<br/>这一步忘了截图.大家执行了就行了<br/><br/>8. 点击 i 键进入 插入编辑方式.并输入<br/>&lt;?php<br/>//hyperblue <a href="http://www.kushu.net" target="_blank" rel="external">http://www.kushu.net</a><br/>$conn = mysql_connect(&#34;localhost&#34;,&#34;root&#34;,&#34;&#34;);<br/>if($conn) echo &#34;&lt;h1&gt;succeed&lt;/h1&gt;&#34;;<br/>else echo &#34;&lt;h1&gt;fail&lt;/h1&gt;&#34;:<br/>?&gt;<br/><br/>9. 点击 Esc 键回到vi 命令行方式.并输入 :wq 然后点击回车<br/>10. 在浏览器中打开 <a href="http://192.168.6.33/phpmyadmin" target="_blank" rel="external">http://192.168.6.33/phpmyadmin</a>可能语句错误先不管它。。<br/>出现如下界面则说明php已经成功关联mysql了<br/>安装phpMyAdmin<br/><br/>1. 执行 cd /home<br/>回到phpmyadmin源码所在目录.<br/>2. 执行 tar -zxvf phpMyAdmin-2.10.0.2-all-languages.tar.gz<br/>解压phpmyadmin.<br/>3. 执行 cp -r phpMyAdmin-2.10.0.2-all-languages/ /server/apache/htdocs/phpmyadmin/<br/>将phpmyadmin剪切到网站根目录下<br/>基本上就差不多了。。。我来设置一下。。我先设置MYSQL密码<br/>设了密码之后这里就连不上了。。要在网页中设置一下。。。我就不设置了我来做一个在linux下安装BBS的演示。。。 ]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.kushu.net/article/php/LAMP.html" /> 
	  <id>http://www.kushu.net/default.asp?id=54</id>
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[PHP验证变量类型]]></title>
	  <author>
		 <name>hyperblue</name>
		 <uri>http://www.kushu.net/</uri>
		 <email>hyperblue@163.com</email>
	  </author>
	  <category term="" scheme="http://www.kushu.net/default.asp?cateID=6" label="PHP" /> 
	  <updated>2010-01-16T13:18:01+08:00</updated>
	  <published>2010-01-16T13:18:01+08:00</published>
		  <summary type="html"><![CDATA[<p><strong>isset() : </strong><font color="#ff6600">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //变量是否已经声明</font><br />
<strong>empty(): </strong><font color="#ff6600">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; </font><font color="#ff6600">//变量是否为空</font><br />
<strong>defined(): </strong><font color="#993300"><font color="#ff6600">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; //常量是否已经定义 define()</font><br />
</font><strong>array_key_exists(mixed key, array search) :</strong><font color="#993300"><font color="#ff6600">//检查给定的键名或索引是否存在于数组中</font><br />
<br />
</font><strong><font color="#000080">判断数据类型</font></strong><br />
<br />
<strong>is_numeric ( mixed var ): </strong><font color="#ff6600">//检测变量是否为数字或数字字符串</font><br />
<strong>is_bool():&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff6600"> //</font></strong><font color="#ff6600">检测变量是否是布尔型</font><br />
<strong>is_float():&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff6600"> //</font></strong><font color="#ff6600">检测变量是否是浮点型 和is_double，is_real()都一样的用法</font><br />
<strong>is_int():&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff6600"> </font></strong><font color="#ff6600">//检测变量是否是整数is_integer()</font><font color="#ff6600">一样的用法</font><br />
<strong>is_string():&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#ff6600">//</font></strong><font color="#ff6600">检测变量是否是字符串</font><br />
<strong>is_object():&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; <font color="#ff6600">//</font></strong><font color="#ff6600">检测变量是否是一个对象</font><br />
<strong>is_array():&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#ff6600">//</font></strong><font color="#ff6600">检测变量是否是数组</font><br />
<strong>is_null(): </strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font color="#ff6600">//检测变量是否为 <tt class="constant"><font face="NSimsun">NULL</font></tt> 值是否是NULL大小写敏感</font><br />
⊙被赋值为 NULL。<br />
⊙尚未被赋值。<br />
⊙被 unset()。<br />
<br />
<font color="#000080"><strong>表P.1.用 PHP 函数对 $x 的比较</strong></font><br />
<strong><br />
表达式</strong> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <strong><font color="#000000">gettype()&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; empty()&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; is_null()&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; isset()&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; boolean </font>: if($x)<br />
<br />
</strong><font color="#000080"><font color="#000000">$x = &quot;&quot;; </font>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; string &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; TRUE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; FALSE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; TRUE &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; FALSE<br />
<font color="#000000">$x = NULL </font>&nbsp;&nbsp; &nbsp;&nbsp; NULL &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; TRUE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; TRUE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FALSE &nbsp;&nbsp; &nbsp;&nbsp; FALSE<br />
<font color="#000000">var $x; </font>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; NULL &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; TRUE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; TRUE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FALSE &nbsp;&nbsp; &nbsp;&nbsp; FALSE<br />
<font color="#000000">$x 尚未定义 </font>&nbsp;&nbsp;&nbsp; NULL &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; TRUE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; TRUE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; FALSE &nbsp;&nbsp;&nbsp; FALSE<br />
<font color="#000000">$x = array();</font> &nbsp;&nbsp; array &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; TRUE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; FALSE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; TRUE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; FALSE<br />
<font color="#000000">$x = false; </font>&nbsp;&nbsp; &nbsp;&nbsp; boolean &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; TRUE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; FALSE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TRUE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; FALSE<br />
<font color="#000000">$x = true; </font>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; boolean &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font color="#000080">FALSE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FALSE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TRUE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; TRUE<br />
<font color="#000000">$x = 1; </font>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; integer &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FALSE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FALSE &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; TRUE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; TRUE<br />
<font color="#000000">$x = 42; </font>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; integer &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FALSE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FALSE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TRUE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; TRUE<br />
<font color="#000000">$x = 0; </font>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; integer &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TRUE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FALSE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TRUE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; FALSE<br />
<font color="#000000">$x = -1;</font> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; integer &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FALSE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FALSE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TRUE &nbsp;&nbsp; </font><font color="#000080">&nbsp;&nbsp;&nbsp; TRUE<br />
<font color="#000000">$x = &quot;1&quot;; </font>&nbsp;&nbsp;&nbsp;&nbsp; string &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FALSE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FALSE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; TRUE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; TRUE<br />
<font color="#000000">$x = &quot;0&quot;;</font> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string &nbsp;&nbsp; </font><font color="#000080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TRUE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FALSE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TRUE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; FALSE<br />
<font color="#000000">$x = &quot;-1&quot;; </font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FALSE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FALSE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TRUE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; TRUE<br />
<font color="#000000">$x = &quot;php&quot;; </font>&nbsp;&nbsp;&nbsp; string &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FALSE &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; FALSE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TRUE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; TRUE<br />
<font color="#000000">$x = &quot;true&quot;; </font>&nbsp;&nbsp;&nbsp; string &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FALSE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FALSE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TRUE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; TRUE<br />
<font color="#000000">$x = &quot;false&quot;; </font>string &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FALSE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FALSE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TRUE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; TRUE<br />
<br />
<strong>表P.2.用 == 进行松散比较<br />
<font size="3"><br />
</font></strong></font>
<table class="datatable" cellspacing="1" cellpadding="2" summary="用 == 进行松散比较" border="0" style="border-collapse: collapse">
    <colgroup><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /></colgroup>
    <thead>
        <tr>
            <th>&nbsp;</th>
            <th><font color="#000080" size="3"><code class="constant"><font face="新宋体"><font color="#000000">TRUE </font>&nbsp;&nbsp;&nbsp;&nbsp; <br />
            </font></code></font></th>
            <th><font color="#000080" size="3"><code class="constant"><font face="新宋体"><font color="#000000">FALSE</font>&nbsp;&nbsp; <br />
            </font></code></font></th>
            <th><font color="#000080" size="3"><code class="literal"><font face="新宋体"><font color="#000000">1 </font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
            </font></code></font></th>
            <th><font color="#000000" size="3"><code class="literal"><font face="新宋体">0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
            </font></code></font></th>
            <th><font color="#000000" size="3"><code class="literal"><font face="新宋体">-1&nbsp;&nbsp;&nbsp;&nbsp; <br />
            </font></code></font></th>
            <th><font color="#000000" size="3"><code class="literal"><font face="新宋体">&quot;1&quot;&nbsp;&nbsp;&nbsp;&nbsp; <br />
            </font></code></font></th>
            <th><font color="#000000" size="3"><code class="literal"><font face="新宋体">&quot;0&quot;&nbsp;&nbsp;&nbsp;&nbsp; <br />
            </font></code></font></th>
            <th><font color="#000000" size="3"><code class="literal"><font face="新宋体">&quot;-1&quot;&nbsp;&nbsp;&nbsp;&nbsp; <br />
            </font></code></font></th>
            <th><font color="#000000" size="3"><code class="constant"><font face="新宋体">NULL&nbsp;&nbsp;&nbsp;&nbsp; <br />
            </font></code></font></th>
            <th><font color="#000000" size="3"><code class="literal"><font face="新宋体">array()&nbsp;&nbsp;&nbsp; <br />
            </font></code></font></th>
            <th><font color="#000000" size="3"><code class="literal"><font face="新宋体">&quot;php&quot;&nbsp;&nbsp;&nbsp; <br />
            </font></code></font></th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><font size="3"><strong><font color="#000000"><code class="constant"><font face="新宋体">TRUE</font></code></font></strong></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
        </tr>
        <tr>
            <td><font size="3"><strong><font color="#000000"><code class="constant"><font face="新宋体">FALSE</font></code></font></strong></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
        </tr>
        <tr>
            <td><font size="3"><strong><font color="#000000"><code class="literal"><font face="新宋体">1</font></code></font></strong></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
        </tr>
        <tr>
            <td><font size="3"><strong><font color="#000000"><code class="literal"><font face="新宋体">0</font></code></font></strong></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
        </tr>
        <tr>
            <td><font size="3"><strong><font color="#000000"><code class="literal"><font face="新宋体">-1</font></code></font></strong></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
        </tr>
        <tr>
            <td><font size="3"><strong><font color="#000000"><code class="literal"><font face="新宋体">&quot;1&quot;</font></code></font></strong></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
        </tr>
        <tr>
            <td><font size="3"><strong><font color="#000000"><code class="literal"><font face="新宋体">&quot;0&quot;</font></code></font></strong></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
        </tr>
        <tr>
            <td><font size="3"><strong><font color="#000000"><code class="literal"><font face="新宋体">&quot;-1&quot;</font></code></font></strong></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
        </tr>
        <tr>
            <td><font size="3"><strong><font color="#000000"><code class="literal"><font face="新宋体">NULL</font></code></font></strong></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
        </tr>
        <tr>
            <td><font size="3"><strong><font color="#000000"><code class="literal"><font face="新宋体">array()</font></code></font></strong></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
        </tr>
        <tr>
            <td><font size="3"><strong><font color="#000000"><code class="literal"><font face="新宋体">&quot;php&quot;</font></code></font></strong></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">FALSE</font></code></font></td>
            <td><font color="#000080" size="3"><code class="constant"><font face="新宋体">TRUE</font></code></font></td>
        </tr>
    </tbody>
</table>
<font color="#000080"><font size="3"><br />
</font></font><font color="#000080"><strong>表P.3.用 === 进行严格比较</strong><br />
<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;<font color="#000000"> &nbsp;&nbsp;&nbsp; <strong>TRUE &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FALSE &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 1 &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 0 -1 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;1&quot; &nbsp;&nbsp; &quot;0&quot; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;-1&quot; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL &nbsp;&nbsp; array() &nbsp;&nbsp; &quot;php&quot;</strong><br />
<strong>TRUE</strong></font> &nbsp;&nbsp; TRUE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE<br />
<strong><font color="#000000">FALSE</font> </strong>&nbsp;&nbsp; FALSE &nbsp;&nbsp; TRUE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE<br />
<font color="#000000"><strong>1</strong> </font>&nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; TRUE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE<br />
<font color="#000000"><strong>0 </strong></font>FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; TRUE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE<br />
<strong><font color="#000000">-1</font> </strong>&nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; TRUE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE<br />
<font color="#000000"><strong>&quot;1&quot; </strong></font>FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; TRUE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE<br />
<font color="#000000"><strong>&quot;0&quot;</strong> </font>&nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; TRUE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE<br />
<font color="#000000"><strong>&quot;-1&quot;</strong></font> &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; TRUE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE<br />
<font color="#000000"><strong>NULL</strong></font> &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; TRUE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE<br />
<font color="#000000"><strong>array()</strong> </font>&nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; TRUE &nbsp;&nbsp; FALSE<br />
<font color="#000000"><strong>&quot;php&quot; </strong></font>&nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; FALSE &nbsp;&nbsp; TRUE</font></p>]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.kushu.net/article/php/53.htm" /> 
	  <id>http://www.kushu.net/default.asp?id=53</id>
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[2010年 武汉第一场雪...]]></title>
	  <author>
		 <name>hyperblue</name>
		 <uri>http://www.kushu.net/</uri>
		 <email>hyperblue@163.com</email>
	  </author>
	  <category term="" scheme="http://www.kushu.net/default.asp?cateID=3" label="Essay" /> 
	  <updated>2010-01-06T13:39:40+08:00</updated>
	  <published>2010-01-06T13:39:40+08:00</published>
		  <summary type="html"><![CDATA[<br/><img src="http://www.kushu.net/attachments/month_1001/m201016133929.gif" border="0" alt=""/><br/><br/>感觉有点冷！手都懒得敲打键盘了！]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.kushu.net/article/essay/52.htm" /> 
	  <id>http://www.kushu.net/default.asp?id=52</id>
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[转眼2010了...]]></title>
	  <author>
		 <name>hyperblue</name>
		 <uri>http://www.kushu.net/</uri>
		 <email>hyperblue@163.com</email>
	  </author>
	  <category term="" scheme="http://www.kushu.net/default.asp?cateID=3" label="Essay" /> 
	  <updated>2010-01-04T20:27:09+08:00</updated>
	  <published>2010-01-04T20:27:09+08:00</published>
		  <summary type="html"><![CDATA[ 今天抽点时间改了下风格，也希望自己新年新气象。<br/>感谢zKing提供风格[<a href="http://www.imeetyou.net" target="_blank" rel="external">http://www.imeetyou.net</a>]<br/><br/>感觉人气还很少哦，PHP道路还很漫长！<br/><br/>越来越冷了，抱着刚买的本本去被窝了~！]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.kushu.net/article/essay/51.htm" /> 
	  <id>http://www.kushu.net/default.asp?id=51</id>
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[MySQL与事务]]></title>
	  <author>
		 <name>hyperblue</name>
		 <uri>http://www.kushu.net/</uri>
		 <email>hyperblue@163.com</email>
	  </author>
	  <category term="" scheme="http://www.kushu.net/default.asp?cateID=12" label="Mysql" /> 
	  <updated>2009-11-24T17:06:11+08:00</updated>
	  <published>2009-11-24T17:06:11+08:00</published>
		  <summary type="html"><![CDATA[今天在网上看见一个关于mysql事物的说明，我觉得写得不错，拿给大家看看<br/><br/>MySQL5.X都已经发布好久了，但是还有很多人认为MySQL是不支持事务处理的，这不得不怪他们是孤陋寡闻的，其实，只要你的MySQL版本支持BDB或InnoDB表类型，那么你的MySQL就具有事务处理的能力。这里面，又以InnoDB表类型用的最多，虽然后来发生了诸如Oracle收购InnoDB等令MySQL不爽的事情，但那些商业上的斗争与技术无关，下面以InnoDB表类型为例简单说一下MySQL中的事务。<br/><br/><br/>先来明确一下事务涉及的相关知识：<br/><br/>事务都应该具备ACID特征。所谓ACID是Atomic（原子性），Consistent（一致性），Isolated（隔离性），Durable（持续性）四个词的首字母所写，下面以“银行转帐”为例来分别说明一下它们的含义：<br/><br/>原子性：组成事务处理的语句形成了一个逻辑单元，不能只执行其中的一部分。换句话说，事务是不可分割的最小单元。比如：银行转帐过程中，必须同时从一个帐户减去转帐金额，并加到另一个帐户中，只改变一个帐户是不合理的。<br/><br/>一致性：在事务处理执行前后，数据库是一致的。也就是说，事务应该正确的转换系统状态。比如：银行转帐过程中，要么转帐金额从一个帐户转入另一个帐户，要么两个帐户都不变，没有其他的情况。<br/><br/>隔离性：一个事务处理对另一个事务处理没有影响。就是说任何事务都不可能看到一个处在不完整状态下的事务。比如说，银行转帐过程中，在转帐事务没有提交之前，另一个转帐事务只能处于等待状态。<br/><br/>持续性：事务处理的效果能够被永久保存下来。反过来说，事务应当能够承受所有的失败，包括服务器、进程、通信以及媒体失败等等。比如：银行转帐过程中，转帐后帐户的状态要能被保存下来。<br/><br/>再来看看哪些问题会用到事务处理：<br/><br/>这里不说“银行转帐”的例子了，说一个大家实际更容易遇到的“网上购书”的例子。先假设一下问题的背景：网上购书，某书（数据库编号为123）只剩最后一本，而这个时候，两个用户对这本书几乎同时发出了购买请求，让我们看看整个过程：<br/><br/>由于博客限制字符，只能贴上网址...<br/><a href="http://blog.jerryjiang.net/?p=48" target="_blank" rel="external">http://blog.jerryjiang.net/?p=48</a>]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.kushu.net/article/mysql/50.htm" /> 
	  <id>http://www.kushu.net/default.asp?id=50</id>
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[php 如何使用抽象类和接口类?]]></title>
	  <author>
		 <name>hyperblue</name>
		 <uri>http://www.kushu.net/</uri>
		 <email>hyperblue@163.com</email>
	  </author>
	  <category term="" scheme="http://www.kushu.net/default.asp?cateID=6" label="PHP" /> 
	  <updated>2009-11-24T16:57:08+08:00</updated>
	  <published>2009-11-24T16:57:08+08:00</published>
		  <summary type="html"><![CDATA[在我才接触php的时候，也觉得这个东西没有什么用，在后来的逐渐接触大系统以后，才发现其实这些东西还是有一定的作用的，下面我就简单的说说。<br/><br/>1.php 接口类:interface<br/><br/>其实他们的作用很简单，当有很多人一起开发一个项目时，可能都会去调用别人写的一些类，那你就会问，我怎么知道他的某个功能的实现方法是怎么命名的呢，这个时候php接口类就起到作用了，当我们定义了一个接口类时，它里面的方式是下面的子类必须实现的，比如 <br/><br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.kushu.net/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>interface Shop<br/>{<br/>public function buy($gid);<br/>public function sell($gid);<br/>public function view($gid);<br/>}<br/></div></div><br/><br/>我声明一个shop接口类，定义了三个方法：买(buy),卖(sell),看(view),那么继承此类的所有子类都必须实现这3个方法少一个都不行，如果子类没有实现这些话，就无法运行。实际上接口类说白了，就是一个类的模板，一个类的规定，如果你属于这类，你就必须遵循我的规定，少一个都不行，但是具体你怎么去做，我不管，那是你的事，如：<br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.kushu.net/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>class BaseShop implements Shop<br/>{<br/>public function buy($gid)<br/>{<br/>echo &#39;你购买了ID为 :&#39; . $gid . &#39;的商品&#39;;<br/>}<br/><br/>public function sell($gid)<br/>{<br/>echo &#39;你购卖ID为 :&#39; . $gid . &#39;的商品&#39;;<br/>}<br/><br/>public function view($gid)<br/>{<br/>echo &#39;你浏览了ID为 :&#39; . $gid . &#39;的商品&#39;;<br/>}<br/>}<br/></div></div><br/><br/>你想想，在一个多人合作的大项目里面，有了接口类是多么的方便，这样你就不用去问别人，你的某某功能的方法名是什么了，当然如果你们喜欢这样我也没有办法。<br/><br/>结论 ： 接口类就是一个类的领导者，指明方向，子类必须完成它指定方法。<br/><br/>2.php 抽象类 : abstract<br/><br/>其实抽象类和接口类有一部分很像，记得在哪里看见这样一句话，抽象类就把类像的部分抽出来，这句看上去很搞笑，其实它说出了抽象类的真理，抽象类的作用是，当你发现你的很多类里面用很多方法你不断的在重复写，那你就可以考虑使用抽象类了，你可能会说“我不是可以重写一个类每个公共类我个实例化一个这个公共类，调用相同的方法就可以了”，这里是可以，实际上抽象类做的工作也就是这个，不过他省去了你实例化的这个步骤，让你就像直接调用本类方法一样方便，而且你还可以重载这个方法。如：<br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.kushu.net/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>abstract class BaseShop {<br/>public function buy($gid)<br/>{<br/>echo &#39;你购买了ID为 :&#39; . $gid . &#39;的商品&#39;;<br/>}<br/><br/>public function sell($gid)<br/>{<br/>echo &#39;你购卖ID为 :&#39; . $gid . &#39;的商品&#39;;<br/>}<br/><br/>public function view($gid)<br/>{<br/>echo &#39;你浏览了ID为 :&#39; . $gid . &#39;的商品&#39;;<br/>}<br/>}<br/><br/>class BallShop extends BaseShop<br/>{<br/>var $itme_id = null;<br/><br/>public function __construct()<br/>{<br/>$this-&gt;itme_id = 2314;<br/>}<br/><br/>public function open()<br/>{<br/>$this-&gt;sell($this-&gt;itme_id);<br/>}<br/>}<br/></div></div><br/><br/>这里是一个例子，想上面一样我定义了一个商店类，抽所了它所有像的部分，买(buy),卖(sell),看(view),并且抽象类里都实现了这些方法，那么继承它的子类就自动获得了这些方法，子类就做它自己独特的东西，介绍代码的重复，提高复用性。<br/><br/>结论： 抽象类就是一个类的服务提供商，拥有众多服务，你不用必须用，当需要的时候你来用就可以，如果你觉得不提供服务不满意，你还可以自己来做。<br/><br/><br/>抽象类和接口是OO里比较难理解的概念，也是比较容易混淆的。<br/><br/>抽象类和接口都不能直接实例化。在抽象类里可以实现一些功能，但在接口里面则不能实现功能。<br/>LZ的例子不好，我给你换个例子：(这里我只是从&lt;&lt;权威编程&gt;&gt;里copy一些例子，因为我也懒，呵呵。) 复制内容到剪贴板 <br/>代码:<br/>抽象类：<br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.kushu.net/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>abstract class Shape <br/>{<br/><br/>function setCenter($x, $y) <br/>{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>$this-&gt;x = $x;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;y = $y;<br/><br/>}<br/><br/><br/>abstract function draw();<br/><br/>protected $x, $y;<br/><br/>}<br/></div></div><br/><br/>接口：<br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.kushu.net/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>interface Loggable <br/>{<br/><br/>function logString();<br/><br/>}<br/></div></div><br/>这里很清楚的显示了在抽象类里，我们贯彻了设原用到点setCenter()的方法，这样，当子类继承它时，就不用再重复写这个设原点的方法了。那么为什么draw的方法要设定成抽象方法呢？这是因为不同的子类要用不同的实现方法。那么我们干脆不要这个什么抽象方法，而在子类里再实现不是更好吗？哈哈，你忘了很多程序员都自称是懒人吗？在抽象类里先定义一个抽象方法，就是告诉你，在子类里面一定要用到这个方法，如果你忘了，漏了，那是不行的。但是因为每个做法不一样，所以我抽象类这里就不把它先做好了。<br/><br/>接口的作用与抽象类相似的地方在于：所有方法都是抽象的，也就是说，如果你要继承这个接口，那么所有的这些方法，你都要在子类里实现，一个不能漏，一个不能忘。<br/><br/>子类继承的例子： 复制内容到剪贴板 <br/>代码:<br/>抽象类的继承：<br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.kushu.net/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>class Square extends Shape <br/>{<br/><br/>function draw()<br/><br/>{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Here goes the code which draws the Square<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br/><br/>}<br/><br/>} <br/><br/><br/><br/>class Circle extends Shape <br/>{<br/>&nbsp;&nbsp;&nbsp;&nbsp;function draw()<br/><br/>{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Here goes the code which draws the Circle<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br/><br/>}<br/><br/>}<br/></div></div><br/><br/>接口的继承：<br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.kushu.net/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>class Person implements Loggable <br/>{<br/><br/>private $name, $address, $idNumber, $age;<br/><br/>function logString() <br/>{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return &#34;class Person: name = $this-&gt;name, ID = $this &gt;idNumber\n&#34;;<br/><br/>}<br/><br/>}<br/><br/><br/><br/>class Product implements Loggable <br/>{<br/><br/>private $name, $price, $expiryDate;<br/><br/>function logString() <br/>{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return &#34;class Product: name = $this-&gt;name, price = $this &gt;price\n&#34;;<br/><br/>}<br/><br/>}<br/></div></div><br/>LZ说：没实际功能为什么还要继承？<br/>因为这是OO设计上的要求。实际应用时的例子不会这么简单。在OO设计时，会把一些通用的方法放在一个类里，但考虑到子类继承时的差异性，又不能把它事先实现，就只好用到这个抽象类或接口了。<br/><br/>LZ说：但是不如一个类离开了父类车，不是照样可以完成自己的功能？<br/>当然你可以在子类里实现所有的功能，甚至于不要父类，但这样做，与过程编程没什么两样，也就谈不上什么OO思想了。<br/><br/>LZ说：一般的类继承后可以覆盖父亲的方法，但是抽象类完全没有功能，难道就是为了好看？<br/>因为你举的例子不好，所以抽象类完全没有功能。但就算抽象类完全没有功能，像接口一样，那也不是为了好看，你以为懒人会吃饱了撑着没事干要找活干吗？道理上面讲过了。<br/><br/>LZ说：麻烦解答下我帖子上关于接口的问题？<br/>原理上面讲过了。<br/><br/>LZ说：想了很久，只是觉得，抽象类和接口都是为了方便读代码的人，或者说是写代码的规范？<br/>错！！！道理上面讲过了。<br/><br/>紫幻凌说：我也一直疑惑为什么要弄个抽象类？普通的父类不也能好好的被继承？为什么一定要抽象呢？<br/>道理讲完了，还疑惑吗？<br/><br/>LZ说：问题是什么时候用。。。想不出什么时候用？<br/>什么时候用抽象类，什么时候用接口，这个嘛，嘿嘿，谁用谁知道！(你以为是卖广告啊？！)<br/><br/>在讲之前，大家要记住OO的一个原则：一个类只能extends一个父类，但可以贯彻多个接口。<br/>比如说 <br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.kushu.net/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>class&nbsp;&nbsp; Square extends Shape implements B, C, ... {<br/>...<br/>}<br/></div></div><br/><br/>有时候，我们需要设计一个物品，比如shape，这个shape有不同的形状，有不同的颜色，可作不同的运动，等等。当然我们可以把这些都放在一个类里面，但这样，如前面说的，只是过程编程，不是OO编程。你会说，像上面例子一样，做一个抽象类，然后在子类里实现所有的功能。好象不错，进步了。这样子类里面要实现形状，颜色，运动等功能，OK吗？记住，OO里面还有一条原则，为了最大程度的做到代码重用，一个类里最好只实现一个功能，也就是说，一个类做形状，一个类做颜色，一个类做运动。这样如果其他的类要用到颜色的功能时，我们就可以重用这个颜色类，同理，这样我们可以很容易的重用运动类，形状类，等等。<br/><br/>但这样问题出来了，现在我们要用到上面所有的功能，但又分散在三个类里面，怎么办？<br/>这时我们就要用到抽象类和接口了。选定一个跟shape关联最大的一项--形状，把它做成抽象类，其他两样，把它们做成接口，然后在子类里面extends一个抽象类，再implements两个接口就行了。如：<br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.kushu.net/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>class&nbsp;&nbsp; Square extends Shape implements 颜色, 运动, ... {<br/>...<br/>}<br/></div></div><br/>]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.kushu.net/article/php/49.htm" /> 
	  <id>http://www.kushu.net/default.asp?id=49</id>
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[软件开发者面试百问]]></title>
	  <author>
		 <name>hyperblue</name>
		 <uri>http://www.kushu.net/</uri>
		 <email>hyperblue@163.com</email>
	  </author>
	  <category term="" scheme="http://www.kushu.net/default.asp?cateID=6" label="PHP" /> 
	  <updated>2009-11-24T16:53:10+08:00</updated>
	  <published>2009-11-24T16:53:10+08:00</published>
		  <summary type="html"><![CDATA[随着国家对软件开发人才的注重，现在市场出现各式各样的IT培训机构，培训出来的人也五花八门，IT企业为招到符合自己公司的技术人才，招到真正技术人员，也列出各式各样的面试问题，对于一些刚毕业出来的学子们确实有些难度，我整理了出来一套软件开发者面试百问发出来（问题也包括招一些高级技术人员），希望能帮到你们的忙。<br/>一、需求<br/><br/>你能给出一些非功能性（或者质量）需求的例子吗？<br/>如果客户需要高性能、使用极其方便而又高度安全，你会给他什么建议？<br/>你能给出一些用来描述需求的不同技术吗？它们各自适用于什么场景？<br/>需求跟踪是什么意思？什么是向前追溯，什么是向后追溯？<br/>你喜欢用什么工具跟踪需求？<br/>你怎么看待需求变化？它是好是坏？给出你的理由。<br/>你怎样研究需求，发现需求？有哪些资源可以用到？<br/>你怎么给需求制定优先级？有哪些技术？<br/>在需求过程中，用户、客户、开发人员各自的职责是什么？<br/>你怎么对待不完整或是令人费解的需求？<br/> <br/><br/>二、功能设计<br/><br/>在功能设计中有哪些隐喻？例出几个成功的例子。<br/>如果有些功能的执行时间很长，怎么能让用户感觉不到太长的等待？<br/>如果用户必须要在一个很小的区域内，从一个常常的列表中选择多个条目，你会用什么控件？<br/>有哪些方法可以保证数据项的完整？<br/>建立系统原型有哪些技术？<br/>应用程序怎样建立对用户行为的预期？给出一些例子。<br/>如何入手设计一组数量庞大而又复杂的特性，你能举出一些设计思路吗？<br/>有一个列表，其中有10个元素，每个元素都有20个字段可以编辑，你怎样设计这种情况？如果是1000个元素，每个元素有3个字段呢？<br/>用不同的颜色对一段文本中的文字标记高亮，这种做法有什么问题？<br/>Web环境和Windows环境各有些什么限制？<br/> <br/><br/>三、技术设计<br/><br/>什么是低耦合和高聚合？封装原则又是什么意思？<br/>在Web应用中，你怎样避免几个人编辑同一段数据所造成的冲突？<br/>你知道设计模式吗？你用过哪些设计模式？在什么场合下用的？<br/>是否了解什么是无状态的业务层？长事务如何与之相适应？<br/>在搭建一个架构，或是技术设计时，你用过几种图？<br/>在N层架构中都有哪些层？它们各自的职责是什么？<br/>有哪些方法可以确保架构中数据的正确和健壮？<br/>面向对象设计和面向组件设计有哪些不同之处？<br/>怎样在数据库中对用户授权、用户配置、权限管理这几项功能建模？<br/>怎样按照等级制度给动物王国（包括各种物种和各自的行为）建模？<br/> <br/><br/>四、程序设计<br/><br/>你怎样保证你的代码可以处理各种错误事件？<br/>解释一下什么是测试驱动开发，举出极限编程中的一些原则。<br/>看别人代码的时候，你最关心什么地方？<br/>什么时候使用抽象类，什么时候使用接口？<br/>除了IDE以外，你还喜欢哪些必不可少的工具？<br/>你怎么保证代码执行速度快，而又不出问题？<br/>什么时候用多态，什么时候用委派？<br/>什么时候使用带有静态成员的类，什么时候使用单例？<br/>你在代码里面怎么提前处理需求的变化？给一些例子。<br/>描述一下实现一段代码的过程，从需求到最终交付。<br/> <br/><br/>五、算法<br/><br/>怎样知道一个数字是不是2的乘方？怎样判断一个数是不是奇数？<br/>怎样找出链表中间的元素？<br/>怎样改变10000个静态HTML页面中所有电话号码的格式？<br/>举出一个你所用过的递归的例子。<br/>在散列表和排序后的列表中找一个元素，哪个查找速度最快？<br/>不管是书、杂志还是网络，你从中所学到的最后一点算法知识是什么？<br/>怎样把字符串反转？你能不用临时的字符串么？<br/>你愿意用什么类型的语言来编写复杂的算法？<br/>有一个数组，里面是从1到1,000,000的整数，其中有一个数字出现了两次，你怎么找出那个重复的数字？<br/>你知道“旅行商问题（Traveling Salesman Problem）”么？<br/> <br/><br/>六、数据结构<br/><br/>怎样在内存中实现伦敦地铁的结构？<br/>怎样以最有效的方式在数据库中存储颜色值？<br/>队列和堆栈区别是什么？<br/>用堆或者栈存储数据的区别是什么？<br/>怎样在数据库中存储N维向量？<br/>你倾向于用哪种类型的语言编写复杂的数据结构？<br/>21的二进制值是什么？十六制值呢？<br/>不管是书、杂志还是网络，你从中所学到的最后一点数据结构的知识是什么？<br/>怎样在XML文档中存储足球比赛结果（包括队伍和比分）？<br/>有哪些文本格式可以保存Unicode字符？<br/> <br/><br/>七、测试<br/><br/>什么是回归测试？怎样知道新引入的变化没有给现有的功能造成破坏？<br/>如果业务层和数据层之间有依赖关系，你该怎么写单元测试？<br/>你用哪些工具测试代码质量？<br/>在产品部署之后，你最常碰到的是什么类型的问题？<br/>什么是代码覆盖率？有多少种代码覆盖率？<br/>功能测试和探索性测试的区别是什么？你怎么对网站进行测试？<br/>测试套件、测试用例、测试计划，这三者之间的区别是什么？你怎么组织测试？<br/>要对电子商务网站做冒烟测试，你会做哪些类型的测试？<br/>客户在验收测试中会发现不满意的东西，怎样减少这种情况的发生？<br/>你去年在测试和质量保证方面学到了哪些东西？<br/> <br/><br/>八、维护<br/><br/>你用哪些工具在维护阶段对产品进行监控？<br/>要想对一个正在产品环境中被使用的产品进行升级，该注意哪些重要事项？<br/>如果在一个庞大的文件中有错误，而代码又无法逐步跟踪，你怎么找出错误？<br/>你怎样保证代码中的变化不会影响产品的其他部分？<br/>你怎样为产品编写技术文档？<br/>你用过哪些方式保证软件产品容易维护？<br/>怎样在产品运行的环境中进行系统调试？<br/>什么是负载均衡？负载均衡的方式有哪些种？<br/>为什么在应用程序的生命周期中，软件维护费用所占的份额最高？<br/>再造工程（re-engineering）和逆向工程（reverse engineering）的区别是什么？<br/> <br/><br/>九、配置管理<br/><br/>你知道配置管理中基线的含义么？怎样把项目中某个重要的时刻冻结？<br/>你一般会把哪些东西纳入版本控制？<br/>怎样可以保证团队中每个人都知道谁改变了哪些东西？<br/>Tag和Branch的区别是什么？在什么情况下该使用tag，什么时候用branch？<br/>怎样管理技术文档——如产品架构文档——的变化？<br/>你用什么统计管理项目中所有数字信息的状态？你最喜欢哪种工具？<br/>如果客户想要对一款已经发布的产品做出变动，你怎么处理？<br/>版本管理和发布管理有什么差异？<br/>对文本文件的变化和二进制文件的变化进行管理，这二者有什么不同？<br/>同时处理多个变更请求，或是同时进行增量开发和维护，这种事情你怎么看待？<br/> <br/><br/>十、项目管理<br/><br/>范围、时间、成本，这三项中哪些是可以由客户控制的？<br/>谁该对项目中所要付出的一切做出估算？谁有权设置最后期限？<br/>减少交付的次数，或是减少每个交付中的工作量，你喜欢哪种做法？<br/>你喜欢用哪种图来跟踪项目进度？<br/>迭代和增量的区别在哪里？<br/>试着解释一下风险管理中用到的实践。风险该如何管理？<br/>你喜欢任务分解还是滚动式计划？<br/>你需要哪些东西帮助你判断项目是否符合时间要求，在预算范围内运作？<br/>DSDM、Prince2、Scrum，这三者之间有哪些区别？<br/>如果客户想要的东西太多，你在范围和时间上怎样跟他达成一致呢？]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.kushu.net/article/php/48.htm" /> 
	  <id>http://www.kushu.net/default.asp?id=48</id>
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[PHP文件下载类]]></title>
	  <author>
		 <name>hyperblue</name>
		 <uri>http://www.kushu.net/</uri>
		 <email>hyperblue@163.com</email>
	  </author>
	  <category term="" scheme="http://www.kushu.net/default.asp?cateID=6" label="PHP" /> 
	  <updated>2009-11-19T17:22:38+08:00</updated>
	  <published>2009-11-19T17:22:38+08:00</published>
		  <summary type="html"><![CDATA[<div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.kushu.net/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">&lt;?<br/>//====================================================<br/>//&nbsp;&nbsp;FileName:download.class.php<br/>//&nbsp;&nbsp;Summary: 文件下载类<br/>//&nbsp;&nbsp; 使用范例：<br/>// $download=new download(&#39;php,exe,html&#39;,false);<br/>//&nbsp;&nbsp;if(!$download-&gt;downloadfile($filename))<br/>//&nbsp;&nbsp;{<br/>//&nbsp;&nbsp;&nbsp;&nbsp;echo $download-&gt;geterrormsg();<br/>//&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>//====================================================<br/><br/>class download{<br/>&nbsp;&nbsp;public&nbsp;&nbsp;$debug=true;<br/>&nbsp;&nbsp;public&nbsp;&nbsp;$errormsg=&#39;&#39;;<br/>&nbsp;&nbsp;public&nbsp;&nbsp;$Filter=array();<br/>&nbsp;&nbsp;public&nbsp;&nbsp;$filename=&#39;&#39;;<br/>&nbsp;&nbsp;public&nbsp;&nbsp;$mineType=&#39;text/plain&#39;;<br/>&nbsp;&nbsp;public&nbsp;&nbsp;$xlq_filetype=array();<br/> <br/>&nbsp;&nbsp;function download($fileFilter=&#39;&#39;,$isdebug=true)<br/>&nbsp;&nbsp;{<br/>&nbsp;&nbsp;&#160;&#160;&#160;&#160;$this-&gt;common_func=$GLOBALS[&#39;common_func&#39;];<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;setFilter($fileFilter);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;setdebug($isdebug);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;setfiletype();<br/>&nbsp;&nbsp;}<br/>&nbsp;&nbsp;<br/>&nbsp;&nbsp;function setFilter($fileFilter)<br/>&nbsp;&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;if(empty($fileFilter)) return ;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;Filter=explode(&#39;,&#39;,strtolower($fileFilter));<br/>&nbsp;&nbsp;}<br/>&nbsp;&nbsp;function setdebug($debug)<br/>&nbsp;&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;debug=$debug;<br/>&nbsp;&nbsp;}<br/>&nbsp;&nbsp;<br/>&nbsp;&nbsp;function setfilename($filename)<br/>&nbsp;&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;filename=$filename;<br/>&nbsp;&nbsp;}<br/>&nbsp;&nbsp;<br/>&nbsp;&nbsp;function downloadfile($filename)<br/>&nbsp;&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;setfilename($filename);<br/>&nbsp;&nbsp;&nbsp;&nbsp;if($this-&gt;filecheck())<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$fn = array_pop( explode( &#39;/&#39;, strtr( $this-&gt;filename, &#39;&#39;, &#39;/&#39; ) ) );<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;header( &#34;Pragma: public&#34; );<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;header( &#34;Expires: 0&#34; ); // set expiration time<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;header( &#34;Cache-Component: must-revalidate, post-check=0, pre-check=0&#34; );<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;header( &#34;Content-type:&#34;.$this-&gt;mineType );<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//header( &#34;Content-Length: &#34;.filesize($this-&gt;filename));<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;header( &#34;Content-Disposition: attachment; filename=&#34;.$fn );<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;header( &#39;Content-Transfer-Encoding: binary&#39; );<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;readfile( $this-&gt;filename );<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return true;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}else<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return false;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;}<br/>&nbsp;&nbsp;function geterrormsg()<br/>&nbsp;&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;return $this-&gt;common_func-&gt;alert($this-&gt;errormsg,&#34;window.close();&#34;,true,true);<br/>&nbsp;&nbsp;}<br/>&nbsp;&nbsp;<br/>&nbsp;&nbsp;function filecheck()<br/>&nbsp;&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;$filename=$this-&gt;filename;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(file_exists($filename))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $filetype=strtolower(array_pop(explode(&#39;.&#39;,$filename)));<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(in_array($filetype,$this-&gt;Filter))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;errormsg.=&#39;不允许下载！&#39;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if($this-&gt;debug) exit($filename.&#39;不允许下载！&#39;) ;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return false;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }else<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( function_exists( &#34;mime_content_type&#34; ) )<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;mineType = mime_content_type( $filename );<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(empty($this-&gt;mineType))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if( isset($this-&gt;xlq_filetype[$filetype]) )&nbsp;&nbsp;$this-&gt;mineType = $this-&gt;xlq_filetype[$filetype];<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(!empty($this-&gt;mineType))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return true;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;errormsg.=&#39;获取文件类型时候发生错误，或者不存在预定文件类型内&#39;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if($this-&gt;debug) exit(&#39;获取文件类型出错&#39;);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return false;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}else<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;errormsg.=&#39;文件不存在!&#39;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if($this-&gt;debug) exit(&#39;文件不存在!&#39;) ;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return false;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;}<br/>&nbsp;&nbsp;<br/>&nbsp;&nbsp;function setfiletype()<br/>&nbsp;&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;chm&#39;]=&#39;application/octet-stream&#39;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;ppt&#39;]=&#39;application/vnd.ms-powerpoint&#39;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;xls&#39;]=&#39;application/vnd.ms-excel&#39;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;doc&#39;]=&#39;application/msword&#39;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;exe&#39;]=&#39;application/octet-stream&#39;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;rar&#39;]=&#39;application/octet-stream&#39;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;js&#39;]=&#34;javascrīpt/js&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;css&#39;]=&#34;text/css&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;hqx&#39;]=&#34;application/mac-binhex40&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;bin&#39;]=&#34;application/octet-stream&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;oda&#39;]=&#34;application/oda&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;pdf&#39;]=&#34;application/pdf&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;ai&#39;]=&#34;application/postsrcipt&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;eps&#39;]=&#34;application/postsrcipt&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;es&#39;]=&#34;application/postsrcipt&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;rtf&#39;]=&#34;application/rtf&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;mif&#39;]=&#34;application/x-mif&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;csh&#39;]=&#34;application/x-csh&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;dvi&#39;]=&#34;application/x-dvi&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;hdf&#39;]=&#34;application/x-hdf&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;nc&#39;]=&#34;application/x-netcdf&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;cdf&#39;]=&#34;application/x-netcdf&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;latex&#39;]=&#34;application/x-latex&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;ts&#39;]=&#34;application/x-troll-ts&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;src&#39;]=&#34;application/x-wais-source&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;zip&#39;]=&#34;application/zip&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;bcpio&#39;]=&#34;application/x-bcpio&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;cpio&#39;]=&#34;application/x-cpio&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;gtar&#39;]=&#34;application/x-gtar&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;shar&#39;]=&#34;application/x-shar&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;sv4cpio&#39;]=&#34;application/x-sv4cpio&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;sv4crc&#39;]=&#34;application/x-sv4crc&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;tar&#39;]=&#34;application/x-tar&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;ustar&#39;]=&#34;application/x-ustar&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;man&#39;]=&#34;application/x-troff-man&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;sh&#39;]=&#34;application/x-sh&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;tcl&#39;]=&#34;application/x-tcl&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;tex&#39;]=&#34;application/x-tex&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;texi&#39;]=&#34;application/x-texinfo&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;texinfo&#39;]=&#34;application/x-texinfo&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;t&#39;]=&#34;application/x-troff&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;tr&#39;]=&#34;application/x-troff&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;roff&#39;]=&#34;application/x-troff&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;shar&#39;]=&#34;application/x-shar&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;me&#39;]=&#34;application/x-troll-me&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;ts&#39;]=&#34;application/x-troll-ts&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;gif&#39;]=&#34;image/gif&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;jpeg&#39;]=&#34;image/pjpeg&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;jpg&#39;]=&#34;image/pjpeg&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;jpe&#39;]=&#34;image/pjpeg&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;ras&#39;]=&#34;image/x-cmu-raster&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;pbm&#39;]=&#34;image/x-portable-bitmap&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;ppm&#39;]=&#34;image/x-portable-pixmap&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;xbm&#39;]=&#34;image/x-xbitmap&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;xwd&#39;]=&#34;image/x-xwindowdump&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;ief&#39;]=&#34;image/ief&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;tif&#39;]=&#34;image/tiff&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;tiff&#39;]=&#34;image/tiff&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;pnm&#39;]=&#34;image/x-portable-anymap&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;pgm&#39;]=&#34;image/x-portable-graymap&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;rgb&#39;]=&#34;image/x-rgb&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;xpm&#39;]=&#34;image/x-xpixmap&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;txt&#39;]=&#34;text/plain&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;c&#39;]=&#34;text/plain&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;cc&#39;]=&#34;text/plain&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;h&#39;]=&#34;text/plain&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;html&#39;]=&#34;text/html&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;htm&#39;]=&#34;text/html&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;htl&#39;]=&#34;text/html&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;rtx&#39;]=&#34;text/richtext&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;etx&#39;]=&#34;text/x-setext&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;tsv&#39;]=&#34;text/tab-separated-values&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;mpeg&#39;]=&#34;video/mpeg&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;mpg&#39;]=&#34;video/mpeg&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;mpe&#39;]=&#34;video/mpeg&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;avi&#39;]=&#34;video/x-msvideo&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;qt&#39;]=&#34;video/quicktime&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;mov&#39;]=&#34;video/quicktime&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;moov&#39;]=&#34;video/quicktime&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;movie&#39;]=&#34;video/x-sgi-movie&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;au&#39;]=&#34;audio/basic&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;snd&#39;]=&#34;audio/basic&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;wav&#39;]=&#34;audio/x-wav&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;aif&#39;]=&#34;audio/x-aiff&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;aiff&#39;]=&#34;audio/x-aiff&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;aifc&#39;]=&#34;audio/x-aiff&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;xlq_filetype[&#39;swf&#39;]=&#34;application/x-shockwave-flash&#34;;<br/>&nbsp;&nbsp;}<br/>}<br/>?&gt;</div></div><br/>]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.kushu.net/article/php/php-class-download.html" /> 
	  <id>http://www.kushu.net/default.asp?id=47</id>
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[window.print()应用网页区域打印]]></title>
	  <author>
		 <name>hyperblue</name>
		 <uri>http://www.kushu.net/</uri>
		 <email>hyperblue@163.com</email>
	  </author>
	  <category term="" scheme="http://www.kushu.net/default.asp?cateID=9" label="JS&amp;AJAX" /> 
	  <updated>2009-11-19T17:14:13+08:00</updated>
	  <published>2009-11-19T17:14:13+08:00</published>
		  <summary type="html"><![CDATA[把要打印的内容放入一个 span或div，然后通过一个函数打印。<br/>原理：利用innerHTML属性把body重写一遍，然后调用print函数打印body。<br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.kushu.net/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;span id=&#39;printeare&#39;&gt;打印内容存放处&lt;/span&gt;<br/>&lt;p&gt;所有内容&lt;/p&gt;<br/>&lt;div id=&#34;div2&#34;&gt;div2的内容&lt;/div&gt;<br/>&lt;a href=&#34;javascript:printme()&#34; target=&#34;_self&#34;&gt;打印&lt;/a&gt;<br/>&lt;coolcode lang=&#34;javascript&#34;&gt;<br/>&lt;script language=&#34;javascript&#34;&gt;<br/>function printme()<br/>{<br/>&nbsp;&nbsp;&nbsp;&nbsp;document.body.innerHTML=document.getElementById(&#39;printeare&#39;).innerHTML+&#39;&lt;br/&gt;&#39;+document.getElementById(&#39;div2&#39;).innerHTML;<br/>&nbsp;&nbsp;&nbsp;&nbsp;window.print();<br/>}<br/>&lt;/script&gt;<br/>&lt;/coolcode&gt;<br/><br/></div></div>]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.kushu.net/article/js_ajax/46.htm" /> 
	  <id>http://www.kushu.net/default.asp?id=46</id>
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[PHP远程下载类]]></title>
	  <author>
		 <name>hyperblue</name>
		 <uri>http://www.kushu.net/</uri>
		 <email>hyperblue@163.com</email>
	  </author>
	  <category term="" scheme="http://www.kushu.net/default.asp?cateID=6" label="PHP" /> 
	  <updated>2009-11-19T17:10:25+08:00</updated>
	  <published>2009-11-19T17:10:25+08:00</published>
		  <summary type="html"><![CDATA[<div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.kushu.net/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&lt;?php<br/><br/>class DownLoad<br/>&nbsp;&nbsp;&nbsp;&nbsp; {<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var $url;//远程文件地址<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var $file_name = &#34;hdwiki.zip&#34;;//下载来的文件名称<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var $save_path = &#34;./up&#100;atefile&#34;;//下载到本地的文件路径<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var $localfile;//下载到本地文件的路径和名称<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var $warning;//警告信息<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var $redown=0;//是否重新下载<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*初始化*/<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function setUrl($url)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(!empty($url))$this-&gt;url = $url;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function setFileName($file_name)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(!empty($file_name))$this-&gt;file_name = $file_name;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function setSavePath($save_path)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(!empty($save_path))$this-&gt;save_path = $save_path;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br/>&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function setRedown($redown)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(!empty($redown))$this-&gt;redown = $redown;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function DownLoad($url, $redown = 0, $save_path = 0, $file_name = 0)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;setUrl($url);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;setFileName($file_name);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;setSavePath($save_path);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;setRedown($redown);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(!file_exists($this-&gt;save_path))<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $dir = explode(&#34;/&#34;,$this-&gt;save_path);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreach($dir as $p)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mkdir($p);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* 检查URL合法性函数 */<br/>&nbsp;&nbsp; function checkUrl(){<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return preg_match(&#34;/^(http|ftp)(:\/\/)([a-zA-Z0-9-_]+[\.\/]+[\w\-_\/]+.*)+$/i&#34;, $this-&gt;url);<br/>&nbsp;&nbsp; }<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //下载文件到本地<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function downLoadFile()<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //检测变量<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;localfile = $this-&gt;save_path.&#34;/&#34;.$this-&gt;file_name;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if($this-&gt;url == &#34;&#34; || $this-&gt;localfile == &#34;&#34;){<br/>&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;warning = &#34;Error: 变量设置错误.&#34;; <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return $this-&gt;warning;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br/>&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!$this-&gt;checkUrl()){<br/>&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;warning = &#34;Error: URL &#34;. $this-&gt;url .&#34; 不合法.&#34;; <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return $this-&gt;warning;<br/>&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp;if (file_exists($this-&gt;localfile)){<br/>&nbsp;&nbsp;&nbsp;&nbsp; if($this-&gt;redown)<br/>&nbsp;&nbsp;&nbsp;&nbsp; {<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unlink($this-&gt;localfile);<br/>&nbsp;&nbsp;&nbsp;&nbsp; }<br/>&nbsp;&nbsp;&nbsp;&nbsp; else<br/>&nbsp;&nbsp;&nbsp;&nbsp; {<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;warning = &#34;Warning: 升级文件 &#34;. $this-&gt;localfile .&#34; 已经存在！ &lt;a href=&#39;?action=download&amp;redown=1&#39; target=&#39;_self&#39;&gt;重新下载&lt;/a&gt;&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return $this-&gt;warning;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //exit(&#34;Error: 本地文件 &#34;. $this-&gt;localfile .&#34; 已经存在,请删除或改名后重新运行本程序.&#34;);<br/>&nbsp;&nbsp;&nbsp;&nbsp; }<br/>&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //打开远程文件<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $fp = fopen($this-&gt;url, &#34;rb&#34;);<br/>&nbsp;&nbsp;&nbsp;&nbsp;if (!$fp){<br/>&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;warning = &#34;Error: 打开远程文件 &#34;. $this-&gt;url .&#34; 失败.&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return $this-&gt;warning;<br/>&nbsp;&nbsp;&nbsp;&nbsp;}<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;//打开本地文件<br/>&nbsp;&nbsp;&nbsp;&nbsp;$sp = fopen($this-&gt;localfile, &#34;wb&#34;);<br/>&nbsp;&nbsp;&nbsp;&nbsp;if (!$sp){<br/>&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;warning = &#34;Error: 打开本地文件 &#34;. $this-&gt;localfile .&#34; 失败.&#34;; <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return $this-&gt;warning;<br/>&nbsp;&nbsp;&nbsp;&nbsp;}<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;//下载远程文件<br/>&nbsp;&nbsp;&nbsp;&nbsp;//echo &#34;正在下载远程文件，请等待&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;while (!feof($fp)){<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$tmpfile .= fread($fp, 1024);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //echo strlen($tmpfile);<br/>&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //保存文件到本地<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fwrite($sp, $tmpfile);<br/>&nbsp;&nbsp;&nbsp;&nbsp;fclose($fp);<br/>&nbsp;&nbsp;&nbsp;&nbsp;fclose($sp);<br/>&nbsp;&nbsp;&nbsp;&nbsp;if($this-&gt;redown)$this-&gt;warning = &#34;Success: 重新下载文件 &#34;. $this-&gt;file_name .&#34; 成功&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;else<br/>&nbsp;&nbsp;&nbsp;&nbsp;$this-&gt;warning = &#34;Success: 下载文件 &#34;. $this-&gt;file_name .&#34; 成功&#34;;<br/>&nbsp;&nbsp;&nbsp;&nbsp;return $this-&gt;warning;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp; }<br/><br/>?&gt;<br/><br/></div></div>]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.kushu.net/article/php/php-class-remotedownload.html" /> 
	  <id>http://www.kushu.net/default.asp?id=45</id>
  </entry>	
		
</feed>
