<?xml version="1.0" encoding="gb2312"?>
<rss version="2.0">
<channel>
    <title>MePHP CMS官方网站 RSS</title>
    <link>http://www.mephp.com/</link>
    <description>MePHP CMS官方网站最新10篇文章</description>
    <copyright>MePHP CMS 1.25</copyright>
    <language>zh-cn</language>
	<item>
	    <title>25个顶级PHP模板引擎</title>
	    <link>http://www.mephp.com/view.php?tid=20&amp;id=65</link>
	    <description><![CDATA[<P><A href="http://smarty.php.net/" $included="null"><FONT color=#ff7800>Smarty</FONT></A><BR>Smarty的特点是将<A class=bodytag href="http://www.yeeyan.com/articles/tag/模板" target=_blank $included="null"><FONT color=#335533>模板</FONT></A>编译成PHP脚本，然后执行这些脚本。很快，非常灵活。</P>
<P><A href="http://www.phpguru.org/static/template.html" $included="null"><FONT color=#ff7800>Heyes Template Class</FONT></A><BR>一个非常容易使用，但功能强大并且快速的<A class=bodytag href="http://www.yeeyan.com/articles/tag/模板" target=_blank $included="null"><FONT color=#335533>模板</FONT></A><A class=bodytag href="http://www.yeeyan.com/articles/tag/引擎" target=_blank $included="null"><FONT color=#335533>引擎</FONT></A>，它帮助你把页面布局和设计从代码中分离。</P>
<P><A href="http://www.thewebmasters.net/php/FastTemplate.phtml" $included="null"><FONT color=#ff7800>FastTemplate</FONT></A><BR>一个简单的变量插值<A class=bodytag href="http://www.yeeyan.com/articles/tag/模板" target=_blank $included="null"><FONT color=#335533>模板</FONT></A>类，它分析你的模板，把变量的值从HTML代码中分离处理。</P>
<P><A href="http://www.maiatech.com/shellpage.php" $included="null"><FONT color=#ff7800>ShellPage</FONT></A><BR>一个简单易用的类，可以让你的整个网站布局基于<A class=bodytag href="http://www.yeeyan.com/articles/tag/模板" target=_blank $included="null"><FONT color=#335533>模板</FONT></A>文件，修改模板就能改变整个站点。</P>
<P><A href="http://www.script.gr/go/scripts/STP/" $included="null"><FONT color=#ff7800>STP Simple Template Parser</FONT></A><BR>一个简单、轻量级并且易于使用的<A class=bodytag href="http://www.yeeyan.com/articles/tag/模板" target=_blank $included="null"><FONT color=#335533>模板</FONT></A>分析类。它可以从多个模板中组装一个页面，把结果页面输出到浏览器或者文件系统。</P>
<P><A href="http://www.net-track.ch/opensource/template/" $included="null"><FONT color=#ff7800>OO Template Class</FONT></A><BR>一个你可以用在自己程序中的面向兑现的<A class=bodytag href="http://www.yeeyan.com/articles/tag/模板" target=_blank $included="null"><FONT color=#335533>模板</FONT></A>类。</P>
<P><A href="http://sourceforge.net/projects/simpletpl" $included="null"><FONT color=#ff7800>SimpleTemplate</FONT></A><BR>一个可以创建和结构化网站的<A class=bodytag href="http://www.yeeyan.com/articles/tag/模板" target=_blank $included="null"><FONT color=#335533>模板</FONT></A><A class=bodytag href="http://www.yeeyan.com/articles/tag/引擎" target=_blank $included="null"><FONT color=#335533>引擎</FONT></A>。它可以解析和编译模板。</P>
<P><A href="http://www.massassi.com/bTemplate/" $included="null"><FONT color=#ff7800>bTemplate</FONT></A><BR>短小但是快速的<A class=bodytag href="http://www.yeeyan.com/articles/tag/模板" target=_blank $included="null"><FONT color=#335533>模板</FONT></A>类，允许你把PHP逻辑代码从HTML修饰代码中分离。</P>
<P><A href="http://phpsavant.com/" $included="null"><FONT color=#ff7800>Savant</FONT></A><BR>一个强大且轻量级的PEAR兼容<A class=bodytag href="http://www.yeeyan.com/articles/tag/模板" target=_blank $included="null"><FONT color=#335533>模板</FONT></A>系统。它是非编译型的，使用PHP语言本身做为它的模板语言。</P>
<P><A href="http://ets.sourceforge.net/" $included="null"><FONT color=#ff7800>ETS - easy template system</FONT></A><BR>可以使用完全相同数据重组<A class=bodytag href="http://www.yeeyan.com/articles/tag/模板" target=_blank $included="null"><FONT color=#335533>模板</FONT></A>的模板系统。</P>
<P><A href="http://macdeviant.com/scripts/template/index.php" $included="null"><FONT color=#ff7800>EasyTemplatePHP</FONT></A><BR>适用于你的站点的一个简单但是强大的<A class=bodytag href="http://www.yeeyan.com/articles/tag/模板" target=_blank $included="null"><FONT color=#335533>模板</FONT></A>系统。</P>
<P><A href="http://vlib.activefish.com/" $included="null"><FONT color=#ff7800>vlibTemplate</FONT></A><BR>一个快速、全能的<A class=bodytag href="http://www.yeeyan.com/articles/tag/模板" target=_blank $included="null"><FONT color=#335533>模板</FONT></A>系统，它包含一个缓存和调试类。</P>
<P><A href="http://avantemplate.sourceforge.net/" $included="null"><FONT color=#ff7800>AvanTemplate</FONT></A><BR>多字节安全的<A class=bodytag href="http://www.yeeyan.com/articles/tag/模板" target=_blank $included="null"><FONT color=#335533>模板</FONT></A><A class=bodytag href="http://www.yeeyan.com/articles/tag/引擎" target=_blank $included="null"><FONT color=#335533>引擎</FONT></A>，占用很少系统资源。它支持变量替换，内容块可以设置显示或隐藏。</P>
<P><A href="http://www.grafxsoftware.com/product.php?id=26" $included="null"><FONT color=#ff7800>Grafx Software’s Fast Template</FONT></A><BR>一个修改版本的Fast Template系统，它包括缓存功能，调试控制台以及沉默去除为赋值块。</P>
<P><A href="http://templatepower.codocad.com/" $included="null"><FONT color=#ff7800>TemplatePower</FONT></A><BR>一个快速、简单、功能强大的<A class=bodytag href="http://www.yeeyan.com/articles/tag/模板" target=_blank $included="null"><FONT color=#335533>模板</FONT></A>类。主要功能有嵌套的动态块支持，块/文件包含支持以及显示/隐藏未赋值的变量。</P>
<P><A href="http://www.virtualcreations.com.au/mark/tagtemplate.htm" $included="null"><FONT color=#ff7800>TagTemplate</FONT></A><BR>这个库的功能被设计来使用<A class=bodytag href="http://www.yeeyan.com/articles/tag/模板" target=_blank $included="null"><FONT color=#335533>模板</FONT></A>文件，同时允许你从HTML文件检索信息。</P>
<P><A href="http://htmltmpl.sourceforge.net/" $included="null"><FONT color=#ff7800>htmltmpl: templating engine</FONT></A><BR>一个适用于Python和PHP的<A class=bodytag href="http://www.yeeyan.com/articles/tag/模板" target=_blank $included="null"><FONT color=#335533>模板</FONT></A><A class=bodytag href="http://www.yeeyan.com/articles/tag/引擎" target=_blank $included="null"><FONT color=#335533>引擎</FONT></A>。它面向希望在项目中分离代码和设计的web应用开发人员。</P>
<P><A href="http://www.cmarshall.net/DreamweaverTemplate" $included="null"><FONT color=#ff7800>PHP Class for Parsing Dreamweaver templates</FONT></A><BR>一个分析Dreamweaver<A class=bodytag href="http://www.yeeyan.com/articles/tag/模板" target=_blank $included="null"><FONT color=#335533>模板</FONT></A>的简单类，被用于Gallery 2 和WordPress的自定义模块中。</P>
<P><A href="http://www.source-code.biz/" $included="null"><FONT color=#ff7800>MiniTemplator (Template Engine)</FONT></A><BR>针对HTML文件的一个紧凑型<A class=bodytag href="http://www.yeeyan.com/articles/tag/模板" target=_blank $included="null"><FONT color=#335533>模板</FONT></A><A class=bodytag href="http://www.yeeyan.com/articles/tag/引擎" target=_blank $included="null"><FONT color=#335533>引擎</FONT></A>。对于模板变量和块定义它具有简单的语法。其中块可以嵌套。</P>
<P><A href="http://www.analysisandsolutions.com/software/layout/layout.htm" $included="null"><FONT color=#ff7800>Layout Solution</FONT></A><BR>简化网站开发和维护。它拥有常用的变量和页面元素使你不需要重复做页面布局工作。</P>
<P><A href="http://zoned.net:81/~xkahn/php/fasttemplate/" $included="null"><FONT color=#ff7800>Cached Fast Template</FONT></A><BR>它已经纳入 <A href="http://php.resourceindex.com/detail/00015.html" $included="null"><FONT color=#ff7800>FastTemplate</FONT></A> ，允许你缓存模板文件，甚至可以在分离的块内容上缓存不同的规格。</P>
<P><A href="http://www.tinybutstrong.com/" $included="null"><FONT color=#ff7800>TinyButStrong</FONT></A><BR>一个支持MySQL, Odbc, Sql-Server和ADODB的<A class=bodytag href="http://www.yeeyan.com/articles/tag/模板" target=_blank $included="null"><FONT color=#335533>模板</FONT></A><A class=bodytag href="http://www.yeeyan.com/articles/tag/引擎" target=_blank $included="null"><FONT color=#335533>引擎</FONT></A>。它包含7个方法和两个属性。</P>
<P><A href="http://www.sitepoint.com/article/beyond-template-engine" $included="null"><FONT color=#ff7800>Brian Lozier’s <A class=bodytag href="http://www.yeeyan.com/articles/tag/php" target=_blank $included="null"><FONT color=#335533>php</FONT></A> based template engine</FONT></A><BR>只有2K大小，非常快并且是面向对象设计。</P>
<P><A href="http://www.phpwact.org/" $included="null"><FONT color=#ff7800>WACT</FONT></A><BR>一个从设计中分离代码的<A class=bodytag href="http://www.yeeyan.com/articles/tag/模板" target=_blank $included="null"><FONT color=#335533>模板</FONT></A><A class=bodytag href="http://www.yeeyan.com/articles/tag/引擎" target=_blank $included="null"><FONT color=#335533>引擎</FONT></A>。</P>
<P><A href="http://phptal.motion-twin.com/" $included="null"><FONT color=#ff7800>PHPTAL</FONT></A><BR>一个PHP下面的XML/XHTML<A class=bodytag href="http://www.yeeyan.com/articles/tag/模板" target=_blank $included="null"><FONT color=#335533>模板</FONT></A>库。</P>
<P>原文：<A href="http://www.whenpenguinsattack.com/2006/07/19/php-template-engine-roundup/">http://www.whenpenguinsattack.com/2006/07/19/php-template-engine-roundup/</A></P>]]></description>
	    <author>spring</author>
	    <pubDate>Sun, 03 Aug 2008 01:06:38 +0000</pubDate>
	</item>
	<item>
	    <title>用EditPlus批量转化文件格式到UTF-8</title>
	    <link>http://www.mephp.com/view.php?tid=22&amp;id=64</link>
	    <description><![CDATA[<DIV id=entryCopyright><STRONG><FONT color=black>Made In Zeal 转载请保留原始链接：</FONT></STRONG><A href="http://www.zeali.net/entry/152"><FONT color=#800080>http://www.zeali.net/entry/152</FONT></A></DIV>
<DIV id=entryTagsLine>标签 ( Tags )： <A title="Tag: editplus" href="http://www.zeali.net/tag/editplus" rel=tag><FONT color=#0000ff>editplus</FONT></A>&nbsp;,&nbsp;<A title="Tag: encoding" href="http://www.zeali.net/tag/encoding" rel=tag><FONT color=#0000ff>encoding</FONT></A></DIV>
<DIV id=entry_introduce>
<DIV class=entry_introduce>前几天<A title=phpXplorer-Web文件浏览器 href="http://www.zeali.net/blog/entry.php?id=141" alt="phpXplorer-Web文件浏览器"><FONT color=#0000ff>给phpXplorer做汉化</FONT></A>，做完之后发现网页编码都是UTF-8的，导致显示出来的汉化后的中文全是乱码。一时之间找不到GB2312-&gt;UTF-8批量转化的工具，又急着要把这套东西给运维人员使用，还好phpXplorer的网页编码统一使用的配置文件的信息，所以临时性把编码改成GB2312解决问题。今天看到<A href="http://www.the7f.com/" target=_blank><FONT color=#0000ff>七楼的日志</FONT></A>，才知道原来自己用了几年的EditPlus就有这个功能，真是众里寻她千百度，蓦然回首，那人却在灯火阑珊处。</DIV></DIV>
<DIV id=entryBody>
<P>用EditPlus来批量转化文件的编码格式到UTF-8，操作很简单。菜单选择 File-&gt;Open 选中所有要进行转化的文件，convert选择"UTF-8"，然后打开。</P>
<DIV style="TEXT-ALIGN: center"><IMG class=pivot-image title=打开文件对话框 alt=打开文件对话框 src="http://www.zeali.net/images/editplus_utf-8/convert_dialog.jpg" border=0></DIV>
<P>这样打开的文件，编码格式就已经是UTF-8的了。接下来你只需要保存一下所有这些打开的文件就大功告成。</P>
<DIV style="TEXT-ALIGN: center"><IMG class=pivot-image title=右键保存所有文件 alt=右键保存所有文件 src="http://www.zeali.net/images/editplus_utf-8/save_dialog.jpg" border=0></DIV>
<DIV style="TEXT-ALIGN: center">&nbsp;</DIV><A href="http://www.mephp.com/">本站</A>注明，转换之后还需要替换字符集为UTF-8,具体参考：<A href="http://www.mephp.com/view.php?tid=22&amp;id=55"><STRONG><FONT color=#ff3300>动态网页的三个统一编码</FONT></STRONG></A></DIV>]]></description>
	    <author>spring</author>
	    <pubDate>Fri, 20 Jun 2008 14:20:12 +0000</pubDate>
	</item>
	<item>
	    <title>免费在线Banner站标logo制作</title>
	    <link>http://www.mephp.com/view.php?tid=17&amp;id=63</link>
	    <description><![CDATA[<P>Banner免费制作、Logo免费制作、站标制作、邮箱图标制作</P>
<P>免费的在线广告条制作网站，完全支持中文。</P>
<P>目前只提供468x60、728X90这两种尺寸的banner，提供的模版非常丰富，每个模版设计的样式精美，而且基本都具备GIF动态闪图效果。</P>
<P>Banner免费制作、Logo免费制作、站标制作、邮箱图标制作</P>
<P>免费在线Banner站标logo制作地址：<A href="http://www.55.la/">http://www.55.la/</A></P>]]></description>
	    <author>spring</author>
	    <pubDate>Sun, 15 Jun 2008 02:41:42 +0000</pubDate>
	</item>
	<item>
	    <title>飞信-中国移动推出可无限量免费发短信的聊天软件</title>
	    <link>http://www.mephp.com/view.php?tid=17&amp;id=62</link>
	    <description><![CDATA[<P>中国移动推出的IM聊天工具软件，最大卖点就是可以不限量免费发短信！只要你的好友也是飞信注册用户（注册成为飞信用户，下载飞信PC客户端、使用飞信PC客户端基本功能，不收取费用），你就可以在电脑上通过飞信PC客户端软件来给TA的手机免费发短信了。当然，如果TA回复你的短信，TA是要花钱的。</P>
<P>网址：<A href="http://www.chanet.com.cn/click.cgi?a=669&amp;d=35719&amp;u=&amp;e=" target=_blank><FONT color=#cc3300>http://www.fetion.com.cn</FONT></A><BR>先要填写手机号，接着会给你的手机发验证码，然后输入短信验证码并设置密码就可以注册成功了。注册成功后下载并安装飞信PC客户端，使用方法和QQ差不多。<BR>另外，中国移动财大气粗，飞信不但可以免费发短信，挂飞信、加好友都可以赚积分抽大奖，奖品有价值2008元的PSP掌上游戏机套装以及10元、50元、100元的手机充值卡。挂QQ可是什么奖品都没有的！<SPAN id=more-60></SPAN></P>
<P>注：注册成为飞信用户，下载飞信PC客户端、使用PC客户端基本功能，不收取费用。建议不要使用手机客户端，会产生GPRS流量费用，即使免费发短信也很不划算，除非你是GPRS不限量包月用户或其它形式的手机上网不限流量包月用户。</P>]]></description>
	    <author>spring</author>
	    <pubDate>Sun, 15 Jun 2008 02:32:58 +0000</pubDate>
	</item>
	<item>
	    <title>MePHP Ver 1.50Bate 测试</title>
	    <link>http://www.mephp.com/view.php?tid=13&amp;id=61</link>
	    <description><![CDATA[<P>MePHP Ver 1.50Bate&nbsp; 安装说明 </P>
<P>=========================================== <BR>版权所有 (c) 2005-2006, MePHP.Com 保留所有权利.<BR>首先感谢您选择 MePHP CMS。<BR>MePHP CMS官方网站为 <A href="http://www.mephp.com">http://www.mephp.com</A>, 技术支持论坛 <A href="http://bbs.mephp.com">http://bbs.mephp.com</A>。<BR>所有用户可以免费使用我们的程序，但必须保留底部的版权信息，特殊用户可以不保留。<BR>未经允许禁止修改本程序用于商业用途！<BR>欢迎所有使用者到论坛来交流，特别是报告程序的BUG，我们会在第一时间修正,谢谢！<BR>=========================================== </P>
<P><BR>1. 系统需求<BR>=========================================== <BR>正常使用该系统您必须保证您的服务器满足如下要求(本程序开发环境)：<BR>1) 软件系统：Apache v1.3.33 (Win32) PHP v4.3.9 (Win32)<BR>2) 数 据 库：MySQL v4.0.25 (Win32)</P>
<P><BR>2. 设置使用<BR>===========================================<BR>1) 下载系统的软件包后，解压到一个文件夹中，然后将此文件夹中文件上传到服务器或者本地WEB目录。<BR>2) 运行根目录下/install.php文件，填写相应的数据，安装成功后请删除/install.php文件。然后登入后台模块配置系统。<BR>3) 在Linux/UNIX服务器下请确认下目录权限设为 777：<BR>&nbsp;&nbsp; /data/backup 目录<BR>&nbsp;&nbsp; /data/upfile 目录<BR>&nbsp;&nbsp; /data/html &nbsp;目录<BR>&nbsp;&nbsp; /data/include/sql_config.php 文件<BR>&nbsp;&nbsp; /data/include/site_config.php 文件</P>
<P><BR>3. MeCMS1.50目标：易用、简化、增强功能：<BR>===========================================<BR>1) 文章发布html编辑器、后台优化<BR>2) 多语言、多编码（utf8、gbk）版本</P>
<P><BR>4. 1.0&amp;1.25升级至1.50：<BR>===========================================<BR>直接运行1.0upto1.25.php和1.25upto1.50.php就可以升级 </P>
<P><BR>5. 备注：<BR>===========================================<BR>1) 由于时间有限，Bate测试版本未完全实现功能(模板及用户权限)，将在1.50正式版本发布；如果你有什么问题或意见，请到论坛上来交流，我们会在第一时间给于回复的。<BR>2) 所有用户可以免费使用我们的程序，但必须保留底部的版权信息，特殊用户可以不保留。未经允许禁止修改本程序用于商业用途！<BR>3) MePHP CMS官方网站为 <A href="http://www.mephp.com">http://www.mephp.com</A>, 技术支持论坛 <A href="http://bbs.mephp.com">http://bbs.mephp.com</A>。<BR>4) 用户出于自愿使用本软件，我们不承担任何因使用本软件而产生问题的相关责任。</P>
<P>版权所有 (c) 2005-2006, MePHP.Com 保留所有权利.</P>]]></description>
	    <author>spring</author>
	    <pubDate>Mon, 18 Jun 2007 18:16:32 +0000</pubDate>
	</item>
	<item>
	    <title>体验AJAX对PHP函数的快速查询</title>
	    <link>http://www.mephp.com/view.php?tid=23&amp;id=60</link>
	    <description><![CDATA[在国外的一个网站看到的，很不错,快速查询函数的各种参数，引用的是他的函数数据库，不过可以扩展函数的实例功能，再加个ajax单独对每个函数实例的查询，这样数据库就很大，所以要有大量的数据库，先查看附件体验下把。如果不能查询，可以把文件下载到本地html再查询，可能的服务器不允许访问外部数据：<br /><a href=http://mephp.com/data/upfile/06-05-01-12-22-45function_search.gif target=_blank><img src=http://mephp.com/data/upfile/06-05-01-12-22-45function_search.gif border=0 onload="javascript:if(this.width>screen.width*0.5) this.width=screen.width*0.5;" alt="如果图片缩小请点击放大" /></a><br />这里只给出JS代码：<br /><table border=0 width=95% cellspacing=1 cellpadding=10 bgcolor=#000000 align=center><tr><td width=100% bgcolor=#e6e6e6>&lt;script&nbsp;type=&quot;text/javascript&quot;&nbsp;&nbsp;language=&quot;javascript&quot;&gt;<br />&nbsp;&lt;!--<br />//创建一个对象函数<br />function&nbsp;createRequestObject()&nbsp;{<br />var&nbsp;xmlhttp;<br />try<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlhttp=new&nbsp;ActiveXObject(&quot;Msxml2.XMLHTTP&quot;);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;catch(e)<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;try<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlhttp=new&nbsp;ActiveXObject(&quot;Microsoft.XMLHTTP&quot;);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;catch(f)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlhttp=null;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;if(!&nbsp;xmlhttp&amp;&amp;typeof&nbsp;XMLHttpRequest!=&quot;undefined&quot;)<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlhttp=new&nbsp;XMLHttpRequest();<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />return&nbsp;&nbsp;xmlhttp;<br />}<br />//创建一个对象<br />var&nbsp;http&nbsp;=&nbsp;createRequestObject();<br />var&nbsp;timeoutholder=null;<br />//查询参数，没什么用<br />function&nbsp;sndReq(search,startpoint)&nbsp;{<br />search=escape(search);<br /><br /><br />try{<br />if(startpoint!=0){<br />var&nbsp;insertstart=&quot;&amp;start=&quot;+startpoint;<br />}<br />else<br />{<br />var&nbsp;insertstart=&quot;&quot;;<br />}<br />//调用他的数据库<br />&nbsp;&nbsp;&nbsp;&nbsp;http.open('get',&nbsp;'http://phpfunctions.nfshost.com/index.php?search='+search+insertstart);<br />&nbsp;&nbsp;&nbsp;&nbsp;http.onreadystatechange&nbsp;=&nbsp;handleResponse;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;http.send(null);<br />document.getElementById('loading').innerHTML=&quot;&nbsp;Loading...&quot;;}<br />catch(e){}<br />finally{}<br /><br />}<br />//查询结果<br />function&nbsp;handleResponse()&nbsp;{<br />try{<br />&nbsp;&nbsp;&nbsp;&nbsp;if((http.readyState&nbsp;==&nbsp;4)&amp;&amp;&nbsp;(http.status&nbsp;==&nbsp;200)){<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;response&nbsp;=&nbsp;http.responseText;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;update&nbsp;=&nbsp;new&nbsp;Array();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.getElementById(&quot;matches&quot;).innerHTML&nbsp;=&nbsp;response;<br />document.getElementById(&quot;a1&quot;).onclick();<br />document.getElementById('loading').innerHTML=&quot;&quot;;<br />}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />catch(e){<br />}<br />finally{}<br />}<br />//列出具体函数的属性<br />function&nbsp;fillin(button,description,usage,version,manual)&nbsp;{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.getElementById(&quot;description&quot;).innerHTML=description;<br />&nbsp;&nbsp;&nbsp;&nbsp;document.getElementById(&quot;usage&quot;).innerHTML=usage;<br />document.getElementById(&quot;version&quot;).innerHTML=version;<br />document.getElementById(&quot;manual&quot;).innerHTML=manual;<br />//document.getElementById(&quot;a1&quot;);<br />for(var&nbsp;i=1;i&lt;6;i++){<br />settocolor(&quot;a&quot;+i,&quot;white&quot;);<br />}<br />//精确匹配标示<br />settocolor(button,&quot;yellow&quot;);<br /><br />}<br /><br />function&nbsp;settocolor(id,color){<br />if&nbsp;(document.getElementById(id)!=null)<br />{<br />document.getElementById(id).style.backgroundColor=color;<br />}<br />}<br />function&nbsp;initialise(){<br />document.getElementById(&quot;search&quot;).focus();<br />}<br />//JS调用查询函数入口<br />function&nbsp;getreadytolook(){<br />var&nbsp;search=document.getElementById(&quot;search&quot;).value;<br />if(timeoutholder!=null)window.clearTimeout(timeoutholder);<br />timeoutholder=window.setTimeout(&quot;sndReq(\'&quot;+search+&quot;\',0);&quot;,&nbsp;400);<br />}<br />//&nbsp;--&gt;<br />&lt;/script&gt;</td></tr></table>]]></description>
	    <author>spring</author>
	    <pubDate>Mon, 01 May 2006 03:56:56 +0000</pubDate>
	</item>
	<item>
	    <title>php中目录、文件操作详谈</title>
	    <link>http://www.mephp.com/view.php?tid=3&amp;id=59</link>
	    <description><![CDATA[一、引论<br /><br />在任何计算机设备中,文件是都是必须的对象,而在web编程中,文件的操作一直是web程序员的头疼的地方,而,文件的操作在cms系统中这是必须的,非常有用的,我们经常遇到生成文件目录,文件(夹)编辑等操作,现在我把php中的这些函数做一详细总结并实例示范如何使用.,关于对应的函数详细介绍,请查阅php手册.此处只总结重点.和需要注意的地方.(这在php手册是没有的.)<br /><br />二、目录操作<br /><br />首先介绍的是一个从目录读取的函数,opendir(),readdir(),closedir(),使用的时候是先打开文件句柄,而后迭代列出:<br /><br /><table border=0 width=95% cellspacing=1 cellpadding=10 bgcolor=#000000 align=center><tr><td width=100% bgcolor=#e6e6e6>&lt;?php<br />$base_dir&nbsp;=&nbsp;&quot;filelist/&quot;;<br />$fso&nbsp;=&nbsp;opendir($base_dir);<br />echo&nbsp;$base_dir.&quot;&lt;hr/&gt;&quot;&nbsp;;<br />while($flist=readdir($fso)){<br />echo&nbsp;$flist.&quot;&lt;br/&gt;&quot;&nbsp;;<br />}<br />closedir($fso)<br />?&gt;</td></tr></table><br />这是讲返回文件目录下面的文件已经目录的程序(0文件将返回false).<br /><br />有时候需要知道目录的信息,可以使用dirname($path)和basename($path),分别返回路径的目录部分和文件名名称部分,可用disk_free_space($path)返回看空间空余空间.<br /><br />创建命令:<br /><br />mkdir($path,0777)<br /><br />,0777是权限码,在非window下可用umask()函数设置.<br /><br />rmdir($path)<br /><br />将删除路径在$path的文件.<br /><br />dir&nbsp;--&nbsp;directory&nbsp;类也是操作文件目录的重要类,有3个方法,read,rewind,close,这是一个仿面向对象的类,它先使用的是打开文件句柄,然后用指针的方式读取的.,这里看php手册:<br /><br /><table border=0 width=95% cellspacing=1 cellpadding=10 bgcolor=#000000 align=center><tr><td width=100% bgcolor=#e6e6e6>&lt;?php<br />$d&nbsp;=&nbsp;dir(&quot;/etc/php5&quot;);<br />echo&nbsp;&quot;Handle:&nbsp;&quot;&nbsp;.&nbsp;$d-&gt;handle&nbsp;.&nbsp;&quot;\n&quot;;<br />echo&nbsp;&quot;Path:&nbsp;&quot;&nbsp;.&nbsp;$d-&gt;path&nbsp;.&nbsp;&quot;\n&quot;;<br />while&nbsp;(false&nbsp;!==&nbsp;($entry&nbsp;=&nbsp;$d-&gt;read()))&nbsp;{<br />echo&nbsp;$entry.&quot;\n&quot;;<br />}<br />$d-&gt;close();<br />?&gt;</td></tr></table><br />输出:<br /><br />Handle:&nbsp;Resource&nbsp;id&nbsp;#2<br />Path:&nbsp;/etc/php5<br />.<br />..<br />apache<br />cgi<br />cli<br /><br />文件的属性也非常重要,文件属性包括创建时间,最后修改时间,所有者,文件组,类型,大小等.<br /><br />下面我们重点谈文件操作.<br /><br /><br />三、文件操作<br /><br />●&nbsp;读文件&nbsp;<br /><br />首先是一个文件看能不能读取(权限问题),或者存在不,我们可以用is_readable函数获取信息.:<br /><br /><table border=0 width=95% cellspacing=1 cellpadding=10 bgcolor=#000000 align=center><tr><td width=100% bgcolor=#e6e6e6>&lt;?php<br />$file&nbsp;=&nbsp;'dirlist.php';<br />if&nbsp;(is_readable($file)&nbsp;==&nbsp;false)&nbsp;{<br />die('文件不存在或者无法读取');<br />}&nbsp;else&nbsp;{<br />echo&nbsp;'存在';<br />}<br />?&gt;</td></tr></table><br />判断文件存在的函数还有file_exists(下面演示),但是这个显然无is_readable全面.,当一个文件存在的话可以用<br /><br /><table border=0 width=95% cellspacing=1 cellpadding=10 bgcolor=#000000 align=center><tr><td width=100% bgcolor=#e6e6e6>&lt;?php<br />$file&nbsp;=&nbsp;&quot;filelist.php&quot;;<br />if&nbsp;(file_exists($file)&nbsp;==&nbsp;false)&nbsp;{<br />die('文件不存在');<br />}<br />$data&nbsp;=&nbsp;file_get_contents($file);<br />echo&nbsp;htmlentities($data);<br />?&gt;</td></tr></table><br />但是file_get_contents函数在较低版本上不支持,可以先创建文件的一个句柄,然后用指针读取全部:<br /><br />$fso&nbsp;=&nbsp;fopen($cacheFile,&nbsp;'r');<br />$data&nbsp;=&nbsp;fread($fso,&nbsp;filesize($cacheFile));<br />fclose($fso);<br /><br />还有一种方式,可以读取二进制的文件:<br /><br />$data&nbsp;=&nbsp;implode('',&nbsp;file($file));<br /><br />●&nbsp;写文件&nbsp;<br /><br />和读取文件的方式一样,先看看是不是能写:<br /><br /><table border=0 width=95% cellspacing=1 cellpadding=10 bgcolor=#000000 align=center><tr><td width=100% bgcolor=#e6e6e6>&lt;?php<br /><br />$file&nbsp;=&nbsp;'dirlist.php';<br />if&nbsp;(is_writable($file)&nbsp;==&nbsp;false)&nbsp;{<br />die(&quot;我是鸡毛,我不能&quot;);<br />}<br />?&gt;</td></tr></table><br />能写了的话可以使用file_put_contents函数写入:<br /><br /><table border=0 width=95% cellspacing=1 cellpadding=10 bgcolor=#000000 align=center><tr><td width=100% bgcolor=#e6e6e6>&lt;?php<br />$file&nbsp;=&nbsp;'dirlist.php';<br />if&nbsp;(is_writable($file)&nbsp;==&nbsp;false)&nbsp;{<br />die('我是鸡毛,我不能');<br />}<br />$data&nbsp;=&nbsp;'我是可鄙,我想要';<br />file_put_contents&nbsp;($file,&nbsp;$data);<br />?&gt;<br /><br />file_put_contents函数在php5中新引进的函数(不知道存在的话用function_exists函数先判断一下)低版本的php无法使用,可以使用如下方式:<br /><br />$f&nbsp;=&nbsp;fopen($file,&nbsp;'w');<br />fwrite($f,&nbsp;$data);<br />fclose($f);</td></tr></table><br />替换之.<br /><br />写文件的时候有时候需要锁定,然后写:<br /><br /><table border=0 width=95% cellspacing=1 cellpadding=10 bgcolor=#000000 align=center><tr><td width=100% bgcolor=#e6e6e6>function&nbsp;cache_page($pageurl,$pagedata){<br />if(!$fso=fopen($pageurl,'w')){<br />$this-&gt;warns('无法打开缓存文件.');//trigger_error<br />return&nbsp;false;<br />}<br />if(!flock($fso,LOCK_EX)){//LOCK_NB,排它型锁定<br />$this-&gt;warns('无法锁定缓存文件.');//trigger_error<br />return&nbsp;false;<br />}<br />if(!fwrite($fso,$pagedata)){//写入字节流,serialize写入其他格式<br />$this-&gt;warns('无法写入缓存文件.');//trigger_error<br />return&nbsp;false;<br />}<br />flock($fso,LOCK_UN);//释放锁定<br />fclose($fso);<br />return&nbsp;true;<br />}</td></tr></table><br />●&nbsp;复制,删除文件&nbsp;<br /><br />php删除文件非常easy,用unlink函数简单操作:<br /><br /><table border=0 width=95% cellspacing=1 cellpadding=10 bgcolor=#000000 align=center><tr><td width=100% bgcolor=#e6e6e6>&lt;?php<br />$file&nbsp;=&nbsp;'dirlist.php';<br />$result&nbsp;=&nbsp;@unlink&nbsp;($file);<br />if&nbsp;($result&nbsp;==&nbsp;false)&nbsp;{<br />echo&nbsp;'蚊子赶走了';<br />}&nbsp;else&nbsp;{<br />echo&nbsp;'无法赶走';<br />}<br />?&gt;</td></tr></table><br />即可.<br /><br />复制文件也很容易:<br /><br /><table border=0 width=95% cellspacing=1 cellpadding=10 bgcolor=#000000 align=center><tr><td width=100% bgcolor=#e6e6e6>&lt;?php<br />$file&nbsp;=&nbsp;'yang.txt';<br />$newfile&nbsp;=&nbsp;'ji.txt';&nbsp;#&nbsp;这个文件父文件夹必须能写<br />if&nbsp;(file_exists($file)&nbsp;==&nbsp;false)&nbsp;{<br />die&nbsp;('小样没上线,无法复制');<br />}<br />$result&nbsp;=&nbsp;copy($file,&nbsp;$newfile);<br />if&nbsp;($result&nbsp;==&nbsp;false)&nbsp;{<br />echo&nbsp;'复制记忆ok';<br />}<br />?&gt;</td></tr></table><br />可以使用rename()函数重命名一个文件夹.其他操作都是这几个函数组合一下就能实现的.<br /><br />●&nbsp;获取文件属性&nbsp;<br /><br />我说几个常见的函数:<br />获取最近修改时间:<br /><br /><table border=0 width=95% cellspacing=1 cellpadding=10 bgcolor=#000000 align=center><tr><td width=100% bgcolor=#e6e6e6>&lt;?php<br />$file&nbsp;=&nbsp;'test.txt';<br />echo&nbsp;date('r',&nbsp;filemtime($file));<br />?&gt;</td></tr></table><br /><br />返回的说unix的时间戳,这在缓存技术常用.<br /><br />相关的还有获取上次被访问的时间fileatime(),filectime()当文件的权限，所有者，所有组或其它&nbsp;inode&nbsp;中的元数据被更新时间,fileowner()函数返回文件所有者<br /><br />$owner&nbsp;=&nbsp;posix_getpwuid(fileowner($file));<br /><br />(非window系统),ileperms()获取文件的权限,<br /><br /><table border=0 width=95% cellspacing=1 cellpadding=10 bgcolor=#000000 align=center><tr><td width=100% bgcolor=#e6e6e6>&lt;?php<br />$file&nbsp;=&nbsp;'dirlist.php';<br />$perms&nbsp;=&nbsp;substr(sprintf('%o',&nbsp;fileperms($file)),&nbsp;-4);<br />echo&nbsp;$perms;<br />?&gt;</td></tr></table><br /><br />filesize()返回文件大小的字节数:<br /><br /><br /><table border=0 width=95% cellspacing=1 cellpadding=10 bgcolor=#000000 align=center><tr><td width=100% bgcolor=#e6e6e6>&lt;?php<br /><br />//&nbsp;输出类似：somefile.txt:&nbsp;1024&nbsp;bytes<br /><br />$filename&nbsp;=&nbsp;'somefile.txt';<br />echo&nbsp;$filename&nbsp;.&nbsp;':&nbsp;'&nbsp;.&nbsp;filesize($filename)&nbsp;.&nbsp;'&nbsp;bytes';<br /><br />?&gt;</td></tr></table><br />获取文件的全部信息有个返回数组的函数stat()函数:<br /><br /><table border=0 width=95% cellspacing=1 cellpadding=10 bgcolor=#000000 align=center><tr><td width=100% bgcolor=#e6e6e6>&lt;?php<br />$file&nbsp;=&nbsp;'dirlist.php';<br />$perms&nbsp;=&nbsp;stat($file);<br />var_dump($perms);<br />?&gt;</td></tr></table><br /><br />那个键对应什么可以查阅详细资料,此处不再展开.<br /><br />四、结束语<br /><br />上面我简要的总结了一下几个文件操作,如果您熟练掌握以上列出的函数,已经在操作的时候没什么大的问题,php文件操作的函数变化比较快,现在已经非常强大了,文件这部分也是学习php非常重要的一部分,希望不要忽略.<br />]]></description>
	    <author>macrolong</author>
	    <pubDate>Mon, 24 Apr 2006 05:34:11 +0000</pubDate>
	</item>
	<item>
	    <title>PHP图片验证码原代码</title>
	    <link>http://www.mephp.com/view.php?tid=3&amp;id=58</link>
	    <description><![CDATA[PHP图片验证码原代码，需支持gd2.dll扩展，需修改PHP.ini后重启IIS&nbsp;or&nbsp;ap&nbsp;<br /><br />调用方法&lt;img&nbsp;src=&quot;this.php&quot;&gt;&nbsp;<br /><br />&nbsp;&nbsp;程序代码:&nbsp;<br /><table border=0 width=95% cellspacing=1 cellpadding=10 bgcolor=#000000 align=center><tr><td width=100% bgcolor=#e6e6e6><br />&lt;?PHP&nbsp;<br />session_start();&nbsp;<br />session_register('SafeCode');&nbsp;<br />$type&nbsp;=&nbsp;'gif';&nbsp;<br />$width=&nbsp;40;&nbsp;<br />$height=&nbsp;16;&nbsp;<br />header(&quot;Content-type:&nbsp;image/&quot;.$type);&nbsp;<br />srand((double)microtime()*1000000);&nbsp;<br />$randval&nbsp;=&nbsp;randStr(4,&quot;&quot;);&nbsp;<br />if($type!='gif'&nbsp;&amp;&amp;&nbsp;function_exists('imagecreatetruecolor')){&nbsp;<br />$im&nbsp;=&nbsp;@imagecreatetruecolor($width,$height);&nbsp;<br />}else{&nbsp;<br />$im&nbsp;=&nbsp;@imagecreate($width,$height);&nbsp;<br />}&nbsp;<br />$r&nbsp;=&nbsp;Array(225,211,255,223);&nbsp;<br />$g&nbsp;=&nbsp;Array(225,236,237,215);&nbsp;<br />$b&nbsp;=&nbsp;Array(225,236,166,125);&nbsp;<br /><br />$key&nbsp;=&nbsp;rand(0,3);&nbsp;<br /><br />$backColor&nbsp;=&nbsp;ImageColorAllocate($im,$r[$key],$g[$key],$b[$key]);//背景色（随机）&nbsp;<br />$borderColor&nbsp;=&nbsp;ImageColorAllocate($im,&nbsp;0,&nbsp;0,&nbsp;0);//边框色&nbsp;<br />$pointColor&nbsp;=&nbsp;ImageColorAllocate($im,&nbsp;255,&nbsp;170,&nbsp;255);//点颜色&nbsp;<br /><br />@imagefilledrectangle($im,&nbsp;0,&nbsp;0,&nbsp;$width&nbsp;-&nbsp;1,&nbsp;$height&nbsp;-&nbsp;1,&nbsp;$backColor);//背景位置&nbsp;<br />@imagerectangle($im,&nbsp;0,&nbsp;0,&nbsp;$width-1,&nbsp;$height-1,&nbsp;$borderColor);&nbsp;//边框位置&nbsp;<br />$stringColor&nbsp;=&nbsp;ImageColorAllocate($im,&nbsp;255,51,153);&nbsp;<br /><br />for($i=0;$i&lt;=100;$i++){&nbsp;<br />$pointX&nbsp;=&nbsp;rand(2,$width-2);&nbsp;<br />$pointY&nbsp;=&nbsp;rand(2,$height-2);&nbsp;<br />@imagesetpixel($im,&nbsp;$pointX,&nbsp;$pointY,&nbsp;$pointColor);&nbsp;<br />}&nbsp;<br /><br />@imagestring($im,&nbsp;3,&nbsp;5,&nbsp;1,&nbsp;$randval,&nbsp;$stringColor);&nbsp;<br />$ImageFun='Image'.$type;&nbsp;<br />$ImageFun($im);&nbsp;<br />@ImageDestroy($im);&nbsp;<br />$_SESSION['SafeCode']&nbsp;=&nbsp;$randval;&nbsp;<br />//产生随机字符串&nbsp;<br />function&nbsp;randStr($len=6,$format='ALL')&nbsp;{&nbsp;<br />switch($format)&nbsp;{&nbsp;<br />case&nbsp;'ALL':&nbsp;<br />$chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';&nbsp;break;&nbsp;<br />case&nbsp;'CHAR':&nbsp;<br />$chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';&nbsp;break;&nbsp;<br />case&nbsp;'NUMBER':&nbsp;<br />$chars='0123456789';&nbsp;break;&nbsp;<br />default&nbsp;:&nbsp;<br />$chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';&nbsp;<br />break;&nbsp;<br />}&nbsp;<br />$string=&quot;&quot;;&nbsp;<br />while(strlen($string)&lt;$len)&nbsp;<br />$string.=substr($chars,(mt_rand()%strlen($chars)),1);&nbsp;<br />return&nbsp;$string;&nbsp;<br />}&nbsp;<br />?&gt;&nbsp;&nbsp;</td></tr></table>]]></description>
	    <author>macrolong</author>
	    <pubDate>Sat, 22 Apr 2006 05:38:06 +0000</pubDate>
	</item>
	<item>
	    <title>隐藏下载地址的php代码</title>
	    <link>http://www.mephp.com/view.php?tid=3&amp;id=56</link>
	    <description><![CDATA[<table border=0 width=95% cellspacing=1 cellpadding=10 bgcolor=#000000 align=center><tr><td width=100% bgcolor=#e6e6e6>&lt;?<br />//show.php<br />//http://show.php?FileName=bGpjXzA2MDQxMzE3MTcyMS5YTFM=&amp;&amp;FileDir=VXNlckZpbGU=&amp;&amp;FileId=OTg2<br /><br />if(!$level&nbsp;||&nbsp;empty($_GET['FileName'])||&nbsp;empty($_GET['FileDir'])||&nbsp;empty($_GET['FileId'])){echo'&lt;script&gt;&nbsp;alert(&quot;非法连接&nbsp;!&quot;);&nbsp;location.replace&nbsp;(&quot;index.php&quot;)&nbsp;&lt;/script&gt;';&nbsp;exit();}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />$file_name=base64_decode($_GET['FileName']);<br />$file_dir=base64_decode($_GET['FileDir']);<br />$FileId=base64_decode($_GET['FileId']);<br /><br />$db&nbsp;=&nbsp;new&nbsp;dbClass($db_username,$db_password,$db_database);<br />$db-&gt;connect();<br />$db-&gt;select();<br />$db-&gt;update('FileInfo','DownNumber=DownNumber+1,LastlyTime=now()','Id=&quot;'.$FileId.'&quot;');<br />$db-&gt;close();<br /><br />$file_dir&nbsp;=&nbsp;$file_dir.&quot;/&quot;;<br />$file&nbsp;=&nbsp;fopen($file_dir&nbsp;.&nbsp;$file_name,&quot;r&quot;);&nbsp;//&nbsp;打开文件&nbsp;<br />//&nbsp;输入文件标签<br />Header(&quot;Content-type:&nbsp;application/octet-stream&quot;);<br />Header(&quot;Accept-Ranges:&nbsp;bytes&quot;);<br />Header(&quot;Accept-Length:&nbsp;&quot;.filesize($file_dir&nbsp;.&nbsp;$file_name));<br />Header(&quot;Content-Disposition:&nbsp;attachment;&nbsp;filename=&quot;&nbsp;.&nbsp;$file_name);<br />//&nbsp;输出文件内容<br />echo&nbsp;fread($file,filesize($file_dir&nbsp;.&nbsp;$file_name));<br />fclose($file);<br />exit();<br /><br />?&gt;&nbsp;</td></tr></table>]]></description>
	    <author>macrolong</author>
	    <pubDate>Sat, 22 Apr 2006 05:32:14 +0000</pubDate>
	</item>
	<item>
	    <title>动态网页的三个统一编码</title>
	    <link>http://www.mephp.com/view.php?tid=22&amp;id=55</link>
	    <description><![CDATA[动态网页的3个申明编码统一，否则回乱码。一般来说，乱码的出现有2种原因，首先是由于编码(charset)设置错误，导致浏览器以错误的编码来解析，从而出现了满屏乱七八糟的“天书”，其次是文件被以错误的编码打开，然后保存，比如一个文本文件原先是GB2312编码的，却以UTF-8编码打开再保存。要解决上述乱码问题，首先需要知道开发中哪些环节涉及到了编码：&nbsp;<br /><br />1、文件编码：指的是页面文件(.html,.php等)本身是以何种编码来保存的。记事本和Dreamweaver或EditPlus再打开页面时候会自动识别文件编码因而不太会出问题。<br /><br />2、页面申明编码：在HTML代码HEAD里面，可以用&lt;meta&nbsp;http-equiv=&quot;Content-Type&quot;&nbsp;content=&quot;text/html;&nbsp;charset=&quot;XXX&quot;&nbsp;/&gt;来告诉浏览器网页采用了什么编码，目前中文网站开发中XXX主要用的是GB2312和UTF-8两种编码。&nbsp;<br /><br />3、数据库连接编码：指的是进行数据库操作时候以哪种编码与数据库传输数据，这里需要注意的是不要与数据库本身的编码混淆，比如MySQL内部默认是latin1编码，也就是说Mysql是以latin1编码来存储数据，以其他编码传输给Mysql的数据会被转换成latin1编码。<br /><br />应用：数据库采用UTF8编码，而页面申明编码是GB2312，这是最常见的产生乱码的原因。这时候在PHP脚本里面直接SELECT数据出来的就是乱码，需要在查询前先使用：&nbsp;<br /><br /><table border=0 width=95% cellspacing=1 cellpadding=10 bgcolor=#000000 align=center><tr><td width=100% bgcolor=#e6e6e6>mysql_query(&quot;SET&nbsp;NAMES&nbsp;GBK&quot;);&nbsp;或mysql_query(&quot;SET&nbsp;NAMES&nbsp;gb2312&quot;);</td></tr></table>（这个语句相当于执行了SET&nbsp;character_set_client=gb2312;&nbsp;SET&nbsp;character_set_results=gb2312;&nbsp;SET&nbsp;character_set_connection=gb2312;&nbsp;不论是插入、更新、删除还是查询操作，只要是操纵数据库，都要先执行SET&nbsp;NAMES&nbsp;“gb2312″，这样才能保证插入和显示的正确性。如果插入操作前没有执行这条语句，仅在查询时执行该语句，则仍然无法保证显示的正确性。）&nbsp;来设定MYSQL连接编码，保证页面申明编码与这里设定的连接编码一致（GBK是GB2312的扩展）。如果页面是UTF-8编码的话，可以用：&nbsp;<table border=0 width=95% cellspacing=1 cellpadding=10 bgcolor=#000000 align=center><tr><td width=100% bgcolor=#e6e6e6>mysql_query(&quot;SET&nbsp;NAMES&nbsp;UTF8&quot;);</td></tr></table>]]></description>
	    <author>spring</author>
	    <pubDate>Thu, 20 Apr 2006 01:05:48 +0000</pubDate>
	</item>
</channel>
</rss>