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

<channel>
	<title>任鸟飞网站设计博客 - 关注网站网页设计、网站博客推广优化及赚钱 &#187; SQL</title>
	<atom:link href="http://renniaofei.com/tag/sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://renniaofei.com</link>
	<description>任鸟飞网站设计博客是一个关注网页设计、网站建设、前端开发、美工设计、推广优化、网站博客赚钱、互联网趣味信息及搜素引擎等的原创设计类博客。海阔凭鱼跃，天高任鸟飞！</description>
	<lastBuildDate>Thu, 09 Feb 2012 12:49:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>PHP如何保留2位小数？</title>
		<link>http://renniaofei.com/code/php2-wei-xiaosh/</link>
		<comments>http://renniaofei.com/code/php2-wei-xiaosh/#comments</comments>
		<pubDate>Sun, 21 Aug 2011 03:02:24 +0000</pubDate>
		<dc:creator>任鸟飞</dc:creator>
				<category><![CDATA[编码]]></category>
		<category><![CDATA[Datebase]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://renniaofei.com/?p=2692</guid>
		<description><![CDATA[<a href="http://cad2d3d.com/wp-content/uploads/http://renniaofei.com/code/php2-wei-xiaosh/" title="PHP如何保留2位小数？"  class="smallthumb"><img src="http://www.awebgallery.com/wp-content/uploads/" alt="PHP如何保留2位小数？" /></a>只爱美人 zhiaimeiren.com 网站是基于 PHP 和 MySQL 搭建起来，之前显示的价格信息都是整数，我在产品提交页面输入2位小数也没用，昨天绕了好大一个弯，不过最终还是解决了。 PHP中有2种保留小数位数的函数，一个是 round()，另一个是 number_format()，round() 会四舍五入，而number_format()主要是规定数据显示样式。 保留2位小数实例 方法1： &#60;?php echo round(1.95583, 2);  // 1.96 ?&#62; 方法2：&#60;?php echo number_format(1234.5678, 2, &#8217;.', ”);  //1234.57 ?&#62; 我按照上面的方法试过之后，价格显示出来的还是整数，后来看了一下数据库中的内容，价格也是整数，想了半天，后来总算恍然大悟，原来是 product 表中的 product_price 字段类型设置成了 int 型，后来抓紧改成 float 型，问题迎刃而解。<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="使用PHP备份MySQL数据库" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp2-wei-xiaosh%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161926.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用PHP备份MySQL数据库</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="优化SQL语句，提高数据库执行效率的8条建议" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp2-wei-xiaosh%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161932.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">优化SQL语句，提高数据库执行效率的8条建议</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="提高WordPress安全性必须掌握的5种方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Ftop-5-wordpress-security-tips%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp2-wei-xiaosh%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161903.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">提高WordPress安全性必须掌握的5种方法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="如何在数据库中一次更新多行多字段" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp2-wei-xiaosh%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161936.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何在数据库中一次更新多行多字段</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Windows 环境下 PHPnow套件 一键安装 Apache + PHP + MySQL" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp2-wei-xiaosh%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/05/21156386.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Windows 环境下 PHPnow套件 一键安装 Apache + PHP + MySQL</font>
                    </a>
                </td>
        </tr>
        <br/>
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">来自无觅网络的相关文章：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="PHP header 重定向 UTF-8编码 报错" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.buicaa.com%2Farticle%2Fphp-header-redirect%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp2-wei-xiaosh%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/08/10441549.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP header 重定向 UTF-8编码 报错 (@buicaa)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP中的会话状态控制(一)" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.wozhutou.com%2Farchives%2F331.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp2-wei-xiaosh%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/12/28/13170282.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP中的会话状态控制(一) (@wozhutou)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP与浏览器端编程语言" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.wozhutou.com%2Farchives%2F289.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp2-wei-xiaosh%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/12/18/12502027.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP与浏览器端编程语言 (@wozhutou)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP数据库操作类NotORM中文手册" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.admpub.com%2Fpost-201.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp2-wei-xiaosh%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/23/33495571.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP数据库操作类NotORM中文手册 (@admpub)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP基础语法入门篇（二）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.wozhutou.com%2Farchives%2F273.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp2-wei-xiaosh%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/12/12/12259160.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP基础语法入门篇（二） (@wozhutou)</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<a href="http://cad2d3d.com/wp-content/uploads/http://renniaofei.com/code/php2-wei-xiaosh/" title="PHP如何保留2位小数？"  class="smallthumb"><img src="http://www.awebgallery.com/wp-content/uploads/" alt="PHP如何保留2位小数？" /></a><p>只爱美人 <a href="http://zhiaimeiren.com" target="_blank">zhiaimeiren.com</a> 网站是基于 <a href="http://renniaofei.com/tag/php/" target="_blank">PHP</a> 和 <a href="http://renniaofei.com/tag/sql/" target="_blank">MySQL</a> 搭建起来，之前显示的价格信息都是整数，我在产品提交页面输入2位小数也没用，昨天绕了好大一个弯，不过最终还是解决了。<span id="more-2692"></span></p>
<p>PHP中有2种保留小数位数的函数，一个是 <a href="http://php.net/manual/en/function.round.php" target="_blank">round()</a>，另一个是 <a href="http://php.net/manual/en/function.number-format.php" target="_blank">number_format()</a>，round() 会四舍五入，而number_format()主要是规定数据显示样式。</p>
<h4>保留2位小数实例</h4>
<p>方法1： &lt;?php echo round(1.95583, 2);  // 1.96<br />
?&gt;</p>
<p>方法2：&lt;?php echo number_format(1234.5678, 2, &#8217;.', ”);  //1234.57<br />
?&gt;</p>
<p>我按照上面的方法试过之后，价格显示出来的还是整数，后来看了一下数据库中的内容，价格也是整数，想了半天，后来总算恍然大悟，原来是 product 表中的 product_price 字段类型设置成了 int 型，后来抓紧改成 float 型，问题迎刃而解。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="使用PHP备份MySQL数据库" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp2-wei-xiaosh%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161926.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用PHP备份MySQL数据库</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="优化SQL语句，提高数据库执行效率的8条建议" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp2-wei-xiaosh%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161932.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">优化SQL语句，提高数据库执行效率的8条建议</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="提高WordPress安全性必须掌握的5种方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Ftop-5-wordpress-security-tips%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp2-wei-xiaosh%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161903.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">提高WordPress安全性必须掌握的5种方法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="如何在数据库中一次更新多行多字段" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp2-wei-xiaosh%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161936.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何在数据库中一次更新多行多字段</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Windows 环境下 PHPnow套件 一键安装 Apache + PHP + MySQL" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp2-wei-xiaosh%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/05/21156386.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Windows 环境下 PHPnow套件 一键安装 Apache + PHP + MySQL</font>
                    </a>
                </td>
        </tr>
        <br/>
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">来自无觅网络的相关文章：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="PHP header 重定向 UTF-8编码 报错" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.buicaa.com%2Farticle%2Fphp-header-redirect%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp2-wei-xiaosh%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/08/10441549.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP header 重定向 UTF-8编码 报错 (@buicaa)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP中的会话状态控制(一)" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.wozhutou.com%2Farchives%2F331.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp2-wei-xiaosh%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/12/28/13170282.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP中的会话状态控制(一) (@wozhutou)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP与浏览器端编程语言" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.wozhutou.com%2Farchives%2F289.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp2-wei-xiaosh%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/12/18/12502027.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP与浏览器端编程语言 (@wozhutou)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP数据库操作类NotORM中文手册" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.admpub.com%2Fpost-201.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp2-wei-xiaosh%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/23/33495571.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP数据库操作类NotORM中文手册 (@admpub)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP基础语法入门篇（二）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.wozhutou.com%2Farchives%2F273.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp2-wei-xiaosh%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/12/12/12259160.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP基础语法入门篇（二） (@wozhutou)</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://renniaofei.com/code/php2-wei-xiaosh/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Windows 环境下 PHPnow套件 一键安装 Apache + PHP + MySQL</title>
		<link>http://renniaofei.com/internet/phpnow-apache-php-mysql/</link>
		<comments>http://renniaofei.com/internet/phpnow-apache-php-mysql/#comments</comments>
		<pubDate>Tue, 02 Aug 2011 14:04:06 +0000</pubDate>
		<dc:creator>任鸟飞</dc:creator>
				<category><![CDATA[网络]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[中文独立博客]]></category>

		<guid isPermaLink="false">http://www.renniaofei.com/?p=2659</guid>
		<description><![CDATA[<a href="http://cad2d3d.com/wp-content/uploads/http://renniaofei.com/internet/phpnow-apache-php-mysql/" title="Windows 环境下 PHPnow套件 一键安装 Apache + PHP + MySQL"  class="smallthumb"><img src="http://www.awebgallery.com/wp-content/uploads/" alt="Windows 环境下 PHPnow套件 一键安装 Apache + PHP + MySQL" /></a>由于 WordPress 3.2.1 要求 PHP 版本至少 5.2.4，没办法，只能升级本机的PHP版本，由于之前也是采用一键安装，对PHP具体的安装方法也不是很了解，所以升级过程中出现了太多问题，后来只好将以前的 Apache + PHP + MySQL 删掉，然后重新安装了PHPnow（http://phpnow.org/）。 在安装 PHPnow 过程中也出现了好多问题，罗列如下： 1.  系统原有的 Apache 和 MySQL 系统服务没有停止，导致安装失败，解决办法：使用命令 “sc delete 服务名”，如果服务名有空格，则服务名需加引号。 2. Vista和Windows 7用户需要使用管理员权限打开CMD.EXE，否则安装过程中会提示权限不够。 3. 需要学会几条简单的 doc命令。比如说 从C盘跳到F盘根目录( doc命令为 F:)，从F盘根目录跳转到Program Files目录（CD Program Files）,执行程序（程序名）。 4.Apache 网站根目录设置，正常情况下需到 Apache 下的 conf 目录找到文件httpd.conf，打开找到DocumentRoot “../htdocs” 和 &#60;Directory “../htdocs”&#62; 两行， 然后修改为你网站所在的目录。但我试过之后，网站根目录没有改变，现在我也不知道为什么，只好网站内容COPY到htdocs目录里。<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="WordPress 3.2.1 要求 PHP 版本至少 5.2.4" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Finternet%2Fwordpress-3-2-1-php-5-2-4%2F&from=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21308327.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress 3.2.1 要求 PHP 版本至少 5.2.4</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="使用PHP备份MySQL数据库" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F&from=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161926.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用PHP备份MySQL数据库</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="互联网技术领域10个最具影响力的中文独立博客" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Finspiration%2Fmost-popular-chinese-blog-related-with-internet-technology%2F&from=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/05/21170199.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">互联网技术领域10个最具影响力的中文独立博客</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="如何在数据库中一次更新多行多字段" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F&from=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161936.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何在数据库中一次更新多行多字段</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="月光博客被黑，中国黑客是流氓" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Finternet%2Fyueguangboke-beihei-heike-liumang%2F&from=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21156567.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">月光博客被黑，中国黑客是流氓</font>
                    </a>
                </td>
        </tr>
        <br/>
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">来自无觅网络的相关文章：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Windows 2003+Apache=多站点" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.citydog.me%2F582.html&from=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/16/12697031.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Windows 2003+Apache=多站点 (@citydog)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP 和 MySQL Web开发 经典书籍" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.buicaa.com%2Farticle%2Fphp-and-mysql-web-development%2F&from=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/08/10441589.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP 和 MySQL Web开发 经典书籍 (@buicaa)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="由Windows向Linux搬家中遇到的问题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.citydog.me%2F734.html&from=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/16/12695331.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">由Windows向Linux搬家中遇到的问题 (@citydog)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="LAMP一键安装包-XAMPP" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.citydog.me%2F1614.html&from=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/16/22856677.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">LAMP一键安装包-XAMPP (@citydog)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP数据库操作类NotORM中文手册" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.admpub.com%2F%3Fpost%3D201&from=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/01/20/14188873.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP数据库操作类NotORM中文手册 (@admpub)</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<a href="http://cad2d3d.com/wp-content/uploads/http://renniaofei.com/internet/phpnow-apache-php-mysql/" title="Windows 环境下 PHPnow套件 一键安装 Apache + PHP + MySQL"  class="smallthumb"><img src="http://www.awebgallery.com/wp-content/uploads/" alt="Windows 环境下 PHPnow套件 一键安装 Apache + PHP + MySQL" /></a><p>由于 <a href="http://www.renniaofei.com/internet/wordpress-3-2-1-php-5-2-4/" target="_blank">WordPress 3.2.1 要求 PHP 版本至少 5.2.4</a>，没办法，只能升级本机的PHP版本，由于之前也是采用一键安装，对PHP具体的安装方法也不是很了解，所以升级过程中出现了太多问题，后来只好将以前的 Apache + PHP + MySQL 删掉，然后重新安装了<a href="http://phpnow.org/" target="_blank">PHPnow</a>（http://phpnow.org/）。<span id="more-2659"></span></p>
<p>在安装 <a href="http://phpnow.org/" target="_blank">PHPnow</a> 过程中也出现了好多问题，罗列如下：</p>
<p>1.  系统原有的 Apache 和 MySQL 系统服务没有停止，导致安装失败，解决办法：使用命令 “sc delete 服务名”，如果服务名有空格，则服务名需加引号。</p>
<p>2. Vista和Windows 7用户需要使用管理员权限打开CMD.EXE，否则安装过程中会提示权限不够。</p>
<p>3. 需要学会几条简单的 doc命令。比如说 从C盘跳到F盘根目录( doc命令为 F:)，从F盘根目录跳转到Program Files目录（CD Program Files）,执行程序（程序名）。</p>
<p><img class="size-full wp-image-2661" title="Windows 环境下 PHPnow套件 一键安装 Apache + PHP + MySQL" src="http://www.renniaofei.com/wp-content/uploads/2011/08/phpnow-apache-php-mysql-doc.gif" alt="Windows 环境下 PHPnow套件 一键安装 Apache + PHP + MySQL" width="328" height="170" /></p>
<p>4.Apache 网站根目录设置，正常情况下需到 Apache 下的 conf 目录找到文件httpd.conf，打开找到DocumentRoot “../htdocs” 和 &lt;Directory “../htdocs”&gt; 两行， 然后修改为你网站所在的目录。但我试过之后，网站根目录没有改变，现在我也不知道为什么，只好网站内容COPY到htdocs目录里。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="WordPress 3.2.1 要求 PHP 版本至少 5.2.4" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Finternet%2Fwordpress-3-2-1-php-5-2-4%2F&from=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21308327.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress 3.2.1 要求 PHP 版本至少 5.2.4</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="使用PHP备份MySQL数据库" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F&from=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161926.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用PHP备份MySQL数据库</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="互联网技术领域10个最具影响力的中文独立博客" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Finspiration%2Fmost-popular-chinese-blog-related-with-internet-technology%2F&from=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/05/21170199.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">互联网技术领域10个最具影响力的中文独立博客</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="如何在数据库中一次更新多行多字段" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F&from=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161936.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何在数据库中一次更新多行多字段</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="月光博客被黑，中国黑客是流氓" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Finternet%2Fyueguangboke-beihei-heike-liumang%2F&from=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21156567.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">月光博客被黑，中国黑客是流氓</font>
                    </a>
                </td>
        </tr>
        <br/>
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">来自无觅网络的相关文章：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Windows 2003+Apache=多站点" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.citydog.me%2F582.html&from=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/16/12697031.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Windows 2003+Apache=多站点 (@citydog)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP 和 MySQL Web开发 经典书籍" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.buicaa.com%2Farticle%2Fphp-and-mysql-web-development%2F&from=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/08/10441589.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP 和 MySQL Web开发 经典书籍 (@buicaa)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="由Windows向Linux搬家中遇到的问题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.citydog.me%2F734.html&from=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/16/12695331.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">由Windows向Linux搬家中遇到的问题 (@citydog)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="LAMP一键安装包-XAMPP" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.citydog.me%2F1614.html&from=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/16/22856677.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">LAMP一键安装包-XAMPP (@citydog)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP数据库操作类NotORM中文手册" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.admpub.com%2F%3Fpost%3D201&from=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/01/20/14188873.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP数据库操作类NotORM中文手册 (@admpub)</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://renniaofei.com/internet/phpnow-apache-php-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress 摘要输出原理分析</title>
		<link>http://renniaofei.com/design/wordpress-the-content-yuanli-fenxi/</link>
		<comments>http://renniaofei.com/design/wordpress-the-content-yuanli-fenxi/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 15:12:16 +0000</pubDate>
		<dc:creator>任鸟飞</dc:creator>
				<category><![CDATA[编码]]></category>
		<category><![CDATA[设计]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[WordPress 教程]]></category>
		<category><![CDATA[技巧]]></category>

		<guid isPermaLink="false">http://www.renniaofei.com/?p=1586</guid>
		<description><![CDATA[<a href="http://cad2d3d.com/wp-content/uploads/http://renniaofei.com/design/wordpress-the-content-yuanli-fenxi/" title="WordPress 摘要输出原理分析"  class="smallthumb"><img src="http://www.awebgallery.com/wp-content/uploads/http://www.renniaofei.com/wp-content/uploads/2010/01/wordpress-excerpt-thumbnail.jpg" alt="WordPress 摘要输出原理分析" /></a>曾在 如何在WordPress显示文章摘要 一文中介绍过如何使用the_excerpt() 和 the_content() 来输出文章摘要。但对于摘要输出的原理却没做深入的分析，摘要输出不仅仅用在WordPress博客上，日常接触到的很多项目也都要求使用摘要输出，因此有必要掌握其原理。 WordPress 在数据库架构、文件体系、代码编写等方面有很多值得我们学习的地方，这里就通过分析Wordpress 的 the_content()函数来分析摘要输出的原理。 the_content()的用法实例： &#60;?php the_content('Read more...'); ?&#62; 使用WordPress的博主都知道，Wordpress使用分隔符 “&#60;!&#8211;more&#8211;&#62;”（不含引号）来分割文章内容，通过调用the_content()函数， “&#60;!&#8211;more&#8211;&#62;”之间的文章内容将以摘要的形式输出。 通过上述分析，我们可以得出，WordPress 摘要输出原理如下： 首先在文章内容插入分隔符“&#60;!&#8211;more&#8211;&#62;”。 然后通过 the_content() 来输出分隔符&#60;!&#8211;more&#8211;&#62;之前的内容。 如何实现上述原理？下面以一个实例来说明： // 获取&#60;!--more--&#62;的位置 $theEndPosition=strrpos($post_content, '&#60;!--more--&#62;'); // 输出指定位置之前的内容 echo substr($post_content,0,$theEndPosition); 总结：只需要简单的调用PHP的strrpos和substr函数，即可实现指定分隔符之前的内容，也即摘要输出。<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="提高WordPress安全性必须掌握的5种方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Ftop-5-wordpress-security-tips%2F&from=http%3A%2F%2Frenniaofei.com%2Fdesign%2Fwordpress-the-content-yuanli-fenxi%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161903.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">提高WordPress安全性必须掌握的5种方法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="博客作者如何在 WordPress 博客中插入视频" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fruhe-zai-wordpress-boke-zhong-charu-shipin%2F&from=http%3A%2F%2Frenniaofei.com%2Fdesign%2Fwordpress-the-content-yuanli-fenxi%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/05/21162011.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">博客作者如何在 WordPress 博客中插入视频</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="如何在WordPress显示文章摘要" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fthe_excerpt-vs-the_content-wordpress%2F&from=http%3A%2F%2Frenniaofei.com%2Fdesign%2Fwordpress-the-content-yuanli-fenxi%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/05/21161888.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何在WordPress显示文章摘要</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="在WordPress中使用Bitly短网址服务" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fwordpress-code-url-shortener-with-bitly%2F&from=http%3A%2F%2Frenniaofei.com%2Fdesign%2Fwordpress-the-content-yuanli-fenxi%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/05/21162734.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">在WordPress中使用Bitly短网址服务</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="使用国外虚拟主机的博主，请记得修改 WordPress 时区" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Finternet%2Fguowai-xunizhuji-wordpress-shiqu%2F&from=http%3A%2F%2Frenniaofei.com%2Fdesign%2Fwordpress-the-content-yuanli-fenxi%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/05/21161995.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用国外虚拟主机的博主，请记得修改 WordPress 时区</font>
                    </a>
                </td>
        </tr>
        <br/>
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">来自无觅网络的相关文章：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="70+wordpress网站设计欣赏" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.shejidaren.com%2F70wordpress%25E7%25BD%2591%25E7%25AB%2599%25E8%25AE%25BE%25E8%25AE%25A1%25E6%25AC%25A3%25E8%25B5%258F.html&from=http%3A%2F%2Frenniaofei.com%2Fdesign%2Fwordpress-the-content-yuanli-fenxi%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/01/20372045.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">70+wordpress网站设计欣赏 (@shejidaren)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress归档/存档：Simple Yearly Archive" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.citydog.me%2F2459.html&from=http%3A%2F%2Frenniaofei.com%2Fdesign%2Fwordpress-the-content-yuanli-fenxi%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/02/01/14629270.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress归档/存档：Simple Yearly Archive (@citydog)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="20+Wordpress电子商务模板" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.shejidaren.com%2F20wordpress%25E5%2595%2586%25E5%259F%258E%25E6%25A8%25A1%25E6%259D%25BF.html&from=http%3A%2F%2Frenniaofei.com%2Fdesign%2Fwordpress-the-content-yuanli-fenxi%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/10/22/9576479.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">20+Wordpress电子商务模板 (@shejidaren)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress代码实现文章摘要" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.99psn.com%2F961.html&from=http%3A%2F%2Frenniaofei.com%2Fdesign%2Fwordpress-the-content-yuanli-fenxi%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/26/25447492.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress代码实现文章摘要 (@99psn)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress博客学习教程" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.99psn.com%2F783.html&from=http%3A%2F%2Frenniaofei.com%2Fdesign%2Fwordpress-the-content-yuanli-fenxi%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/26/24208983.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress博客学习教程 (@99psn)</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<a href="http://cad2d3d.com/wp-content/uploads/http://renniaofei.com/design/wordpress-the-content-yuanli-fenxi/" title="WordPress 摘要输出原理分析"  class="smallthumb"><img src="http://www.awebgallery.com/wp-content/uploads/http://www.renniaofei.com/wp-content/uploads/2010/01/wordpress-excerpt-thumbnail.jpg" alt="WordPress 摘要输出原理分析" /></a><p>曾在 <a href="http://www.renniaofei.com/code/the_excerpt-vs-the_content-wordpress/">如何在WordPress显示文章摘要</a> 一文中介绍过如何使用the_excerpt() 和 the_content() 来输出文章摘要。但对于摘要输出的原理却没做深入的分析，摘要输出不仅仅用在<a href="http://www.renniaofei.com/tag/wordpress-tutorials/">WordPress博客</a>上，日常接触到的很多项目也都要求使用摘要输出，因此有必要掌握其原理。<span id="more-1586"></span></p>
<p>WordPress 在<a href="http://www.renniaofei.com/tag/datebase/">数据库架构</a>、文件体系、<a href="http://www.renniaofei.com/category/code/">代码编写</a>等方面有很多值得我们学习的地方，这里就通过分析Wordpress 的 the_content()函数来分析摘要输出的原理。</p>
<h4>the_content()的用法实例：</h4>
<pre><code>&lt;?php the_content('Read more...'); ?&gt;</code></pre>
<p>使用<a href="http://www.renniaofei.com/tag/chinese-independent-blog/">WordPress的博主</a>都知道，Wordpress使用分隔符 “&lt;!&#8211;more&#8211;&gt;”（不含引号）来分割文章内容，通过调用the_content()函数，  “&lt;!&#8211;more&#8211;&gt;”之间的文章内容将以摘要的形式输出。</p>
<h4>通过上述分析，我们可以得出，WordPress 摘要输出原理如下：</h4>
<ol>
<li>首先在文章内容插入分隔符“&lt;!&#8211;more&#8211;&gt;”。</li>
<li>然后通过 the_content() 来输出分隔符&lt;!&#8211;more&#8211;&gt;之前的内容。</li>
</ol>
<h4>如何实现上述原理？下面以一个实例来说明：</h4>
<pre><code>// 获取&lt;!--more--&gt;的位置
$theEndPosition=strrpos($post_content, '&lt;!--more--&gt;');
// 输出指定位置之前的内容
echo substr($post_content,0,$theEndPosition);</code></pre>
<p>总结：只需要简单的调用<a href="http://www.renniaofei.com/tag/php/">PHP</a>的strrpos和substr函数，即可实现指定分隔符之前的内容，也即摘要输出。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="提高WordPress安全性必须掌握的5种方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Ftop-5-wordpress-security-tips%2F&from=http%3A%2F%2Frenniaofei.com%2Fdesign%2Fwordpress-the-content-yuanli-fenxi%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161903.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">提高WordPress安全性必须掌握的5种方法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="博客作者如何在 WordPress 博客中插入视频" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fruhe-zai-wordpress-boke-zhong-charu-shipin%2F&from=http%3A%2F%2Frenniaofei.com%2Fdesign%2Fwordpress-the-content-yuanli-fenxi%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/05/21162011.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">博客作者如何在 WordPress 博客中插入视频</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="如何在WordPress显示文章摘要" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fthe_excerpt-vs-the_content-wordpress%2F&from=http%3A%2F%2Frenniaofei.com%2Fdesign%2Fwordpress-the-content-yuanli-fenxi%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/05/21161888.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何在WordPress显示文章摘要</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="在WordPress中使用Bitly短网址服务" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fwordpress-code-url-shortener-with-bitly%2F&from=http%3A%2F%2Frenniaofei.com%2Fdesign%2Fwordpress-the-content-yuanli-fenxi%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/05/21162734.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">在WordPress中使用Bitly短网址服务</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="使用国外虚拟主机的博主，请记得修改 WordPress 时区" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Finternet%2Fguowai-xunizhuji-wordpress-shiqu%2F&from=http%3A%2F%2Frenniaofei.com%2Fdesign%2Fwordpress-the-content-yuanli-fenxi%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/05/21161995.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用国外虚拟主机的博主，请记得修改 WordPress 时区</font>
                    </a>
                </td>
        </tr>
        <br/>
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">来自无觅网络的相关文章：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="70+wordpress网站设计欣赏" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.shejidaren.com%2F70wordpress%25E7%25BD%2591%25E7%25AB%2599%25E8%25AE%25BE%25E8%25AE%25A1%25E6%25AC%25A3%25E8%25B5%258F.html&from=http%3A%2F%2Frenniaofei.com%2Fdesign%2Fwordpress-the-content-yuanli-fenxi%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/01/20372045.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">70+wordpress网站设计欣赏 (@shejidaren)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress归档/存档：Simple Yearly Archive" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.citydog.me%2F2459.html&from=http%3A%2F%2Frenniaofei.com%2Fdesign%2Fwordpress-the-content-yuanli-fenxi%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/02/01/14629270.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress归档/存档：Simple Yearly Archive (@citydog)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="20+Wordpress电子商务模板" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.shejidaren.com%2F20wordpress%25E5%2595%2586%25E5%259F%258E%25E6%25A8%25A1%25E6%259D%25BF.html&from=http%3A%2F%2Frenniaofei.com%2Fdesign%2Fwordpress-the-content-yuanli-fenxi%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/10/22/9576479.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">20+Wordpress电子商务模板 (@shejidaren)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress代码实现文章摘要" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.99psn.com%2F961.html&from=http%3A%2F%2Frenniaofei.com%2Fdesign%2Fwordpress-the-content-yuanli-fenxi%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/26/25447492.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress代码实现文章摘要 (@99psn)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress博客学习教程" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.99psn.com%2F783.html&from=http%3A%2F%2Frenniaofei.com%2Fdesign%2Fwordpress-the-content-yuanli-fenxi%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/26/24208983.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress博客学习教程 (@99psn)</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://renniaofei.com/design/wordpress-the-content-yuanli-fenxi/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>提高WordPress安全性必须掌握的5种方法</title>
		<link>http://renniaofei.com/code/top-5-wordpress-security-tips/</link>
		<comments>http://renniaofei.com/code/top-5-wordpress-security-tips/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 11:41:44 +0000</pubDate>
		<dc:creator>任鸟飞</dc:creator>
				<category><![CDATA[编码]]></category>
		<category><![CDATA[Datebase]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[WordPress 教程]]></category>

		<guid isPermaLink="false">http://www.renniaofei.com/?p=1180</guid>
		<description><![CDATA[<a href="http://cad2d3d.com/wp-content/uploads/http://renniaofei.com/code/top-5-wordpress-security-tips/" title="提高Wordpress安全性必须掌握的5种方法"  class="smallthumb"><img src="http://www.awebgallery.com/wp-content/uploads/http://www.renniaofei.com/wp-content/uploads/2010/05/display-timeago-for-wordpress-if-less-than-24-hours-thumbnail.jpg" alt="提高Wordpress安全性必须掌握的5种方法" /></a>WordPress是一种使用 PHP 语言开发的博客平台，用户可以在支持 PHP 和 MySQL 数据库的服务器上架设自己的博客。全球大约有20%的用户在使用 WordPress，其中包括 yahoo，BBC 等。 随着用户的增加，其安全性也日渐提上日程，这里整理了5条提高 WordPress 安全性的建议供参考。 1. 尽量避免使用admin用户 admin 是安装 WordPress 时产生的管理员用户，拥有所有权限，在安装 WordPress 时，尽量将 admin 对应的密码设置的复杂一些。 2. 将wp-config.php移动到其他目录 如果根目录下没有找到wp-config.php，Wordpress会自动寻找其他目录。 3. 更改Wordpress数据库中的表名前缀 在安装 WordPress 时，默认会将数据库中的表名前缀设置为“wp_”，应尽量修改此前缀。如果 wordpress 已安装完毕，可以利用这个插件 WP Security Scan  来设置。 4. 使用密钥 Secret Keys 访问 http://api.wordpress.org/secret-key/1.1/ ，生成4组密钥，将此4组密钥复制到 wp-config.php。 5.使用 .htaccess 可以限制其他用户访问 wp-admin 目录，我们可以利用下面的代码来指定允许某些特定的IP访问此目录。 AuthUserFile /dev/null AuthGroupFile /dev/null AuthName "Access Control" [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="WordPress 摘要输出原理分析" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fdesign%2Fwordpress-the-content-yuanli-fenxi%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Ftop-5-wordpress-security-tips%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161871.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress 摘要输出原理分析</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="忘记 WordPress 管理员密码怎么办？" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fwordpress-guanliyuan-mima%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Ftop-5-wordpress-security-tips%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/05/21172127.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">忘记 WordPress 管理员密码怎么办？</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="使用PHP备份MySQL数据库" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Ftop-5-wordpress-security-tips%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161926.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用PHP备份MySQL数据库</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="优化SQL语句，提高数据库执行效率的8条建议" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Ftop-5-wordpress-security-tips%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161932.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">优化SQL语句，提高数据库执行效率的8条建议</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="如何在WordPress中随机显示文章" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fdisplay-random-posts-in-wordpress%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Ftop-5-wordpress-security-tips%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21179716.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何在WordPress中随机显示文章</font>
                    </a>
                </td>
        </tr>
        <br/>
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">来自无觅网络的相关文章：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="70+wordpress网站设计欣赏" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.shejidaren.com%2F70wordpress%25E7%25BD%2591%25E7%25AB%2599%25E8%25AE%25BE%25E8%25AE%25A1%25E6%25AC%25A3%25E8%25B5%258F.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Ftop-5-wordpress-security-tips%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/01/20372045.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">70+wordpress网站设计欣赏 (@shejidaren)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="[WordPress主题]Proyecto-适合商业及图片类" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.citydog.me%2F2462.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Ftop-5-wordpress-security-tips%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/02/01/14635502.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">[WordPress主题]Proyecto-适合商业及图片类 (@citydog)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress归档/存档：Simple Yearly Archive" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.citydog.me%2F2459.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Ftop-5-wordpress-security-tips%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/02/01/14629270.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress归档/存档：Simple Yearly Archive (@citydog)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="15个新Wordpress主题支持多设备浏览（PC/iPhone/iPad/Android）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.shejidaren.com%2Fnew-wordpress-themes-for-p-iphone-ipad-andriod.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Ftop-5-wordpress-security-tips%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/09/29564201.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">15个新Wordpress主题支持多设备浏览（PC/iPhone/iPad/Android） (@shejidaren)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="分享11个提供精品wordpress主题下载的网站" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.shejidaren.com%2F%25E5%2588%2586%25E4%25BA%25AB11%25E4%25B8%25AA%25E6%258F%2590%25E4%25BE%259B%25E7%25B2%25BE%25E5%2593%2581wordpress%25E4%25B8%25BB%25E9%25A2%2598%25E4%25B8%258B%25E8%25BD%25BD%25E7%259A%2584%25E7%25BD%2591%25E7%25AB%2599.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Ftop-5-wordpress-security-tips%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/02/20539341.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">分享11个提供精品wordpress主题下载的网站 (@shejidaren)</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<a href="http://cad2d3d.com/wp-content/uploads/http://renniaofei.com/code/top-5-wordpress-security-tips/" title="提高Wordpress安全性必须掌握的5种方法"  class="smallthumb"><img src="http://www.awebgallery.com/wp-content/uploads/http://www.renniaofei.com/wp-content/uploads/2010/05/display-timeago-for-wordpress-if-less-than-24-hours-thumbnail.jpg" alt="提高Wordpress安全性必须掌握的5种方法" /></a><p>WordPress是一种使用 <a href="http://www.renniaofei.com/tag/php/">PHP</a> 语言开发的博客平台，用户可以在支持 <a href="http://www.renniaofei.com/tag/php/">PHP</a> 和 <a href="http://www.renniaofei.com/tag/datebase/">MySQL</a> 数据库的服务器上架设自己的博客。全球大约有20%的用户在使用 <a href="http://www.renniaofei.com/">WordPress</a>，其中包括 yahoo，BBC 等。<span id="more-1180"></span><br />
随着用户的增加，其安全性也日渐提上日程，这里整理了5条提高 WordPress 安全性的建议供参考。</p>
<h4>1. 尽量避免使用admin用户</h4>
<p>admin 是安装 WordPress 时产生的管理员用户，拥有所有权限，在安装 WordPress 时，尽量将 admin 对应的密码设置的复杂一些。</p>
<h4>2. 将wp-config.php移动到其他目录</h4>
<p>如果根目录下没有找到wp-config.php，Wordpress会自动寻找其他目录。</p>
<h4>3. 更改Wordpress数据库中的表名前缀</h4>
<p>在安装 WordPress 时，默认会将数据库中的表名前缀设置为“wp_”，应尽量修改此前缀。如果 wordpress 已安装完毕，可以利用这个插件 <a href="http://wordpress.org/extend/plugins/wp-security-scan/" target="_blank">WP Security Scan</a>  来设置。</p>
<h4>4. 使用密钥 Secret Keys</h4>
<p>访问 <a href="http://api.wordpress.org/secret-key/1.1/ ">http://api.wordpress.org/secret-key/1.1/</a> ，生成4组密钥，将此4组密钥复制到 wp-config.php。</p>
<h4>5.使用 .htaccess</h4>
<p>可以限制其他用户访问 wp-admin 目录，我们可以利用下面的代码来指定允许某些特定的IP访问此目录。</p>
<pre><code>AuthUserFile /dev/null
AuthGroupFile /dev/null
AuthName "Access Control"
AuthType Basic
order deny,allow
deny from all
#IP address to Whitelist
allow from xxx.xxx.xxx.xxx</code></pre>
<p>说明：如果需要指定多个IP，可以重复“allow from xxx.xxx.xxx.xxx”（不含引号）即可。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="WordPress 摘要输出原理分析" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fdesign%2Fwordpress-the-content-yuanli-fenxi%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Ftop-5-wordpress-security-tips%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161871.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress 摘要输出原理分析</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="忘记 WordPress 管理员密码怎么办？" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fwordpress-guanliyuan-mima%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Ftop-5-wordpress-security-tips%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/05/21172127.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">忘记 WordPress 管理员密码怎么办？</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="使用PHP备份MySQL数据库" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Ftop-5-wordpress-security-tips%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161926.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用PHP备份MySQL数据库</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="优化SQL语句，提高数据库执行效率的8条建议" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Ftop-5-wordpress-security-tips%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161932.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">优化SQL语句，提高数据库执行效率的8条建议</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="如何在WordPress中随机显示文章" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fdisplay-random-posts-in-wordpress%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Ftop-5-wordpress-security-tips%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21179716.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何在WordPress中随机显示文章</font>
                    </a>
                </td>
        </tr>
        <br/>
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">来自无觅网络的相关文章：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="70+wordpress网站设计欣赏" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.shejidaren.com%2F70wordpress%25E7%25BD%2591%25E7%25AB%2599%25E8%25AE%25BE%25E8%25AE%25A1%25E6%25AC%25A3%25E8%25B5%258F.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Ftop-5-wordpress-security-tips%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/01/20372045.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">70+wordpress网站设计欣赏 (@shejidaren)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="[WordPress主题]Proyecto-适合商业及图片类" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.citydog.me%2F2462.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Ftop-5-wordpress-security-tips%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/02/01/14635502.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">[WordPress主题]Proyecto-适合商业及图片类 (@citydog)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress归档/存档：Simple Yearly Archive" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.citydog.me%2F2459.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Ftop-5-wordpress-security-tips%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/02/01/14629270.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress归档/存档：Simple Yearly Archive (@citydog)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="15个新Wordpress主题支持多设备浏览（PC/iPhone/iPad/Android）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.shejidaren.com%2Fnew-wordpress-themes-for-p-iphone-ipad-andriod.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Ftop-5-wordpress-security-tips%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/09/29564201.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">15个新Wordpress主题支持多设备浏览（PC/iPhone/iPad/Android） (@shejidaren)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="分享11个提供精品wordpress主题下载的网站" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.shejidaren.com%2F%25E5%2588%2586%25E4%25BA%25AB11%25E4%25B8%25AA%25E6%258F%2590%25E4%25BE%259B%25E7%25B2%25BE%25E5%2593%2581wordpress%25E4%25B8%25BB%25E9%25A2%2598%25E4%25B8%258B%25E8%25BD%25BD%25E7%259A%2584%25E7%25BD%2591%25E7%25AB%2599.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Ftop-5-wordpress-security-tips%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/02/20539341.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">分享11个提供精品wordpress主题下载的网站 (@shejidaren)</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://renniaofei.com/code/top-5-wordpress-security-tips/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>使用PHP备份MySQL数据库</title>
		<link>http://renniaofei.com/code/using-php-to-backup-mysql-databases/</link>
		<comments>http://renniaofei.com/code/using-php-to-backup-mysql-databases/#comments</comments>
		<pubDate>Tue, 04 May 2010 14:50:36 +0000</pubDate>
		<dc:creator>任鸟飞</dc:creator>
				<category><![CDATA[编码]]></category>
		<category><![CDATA[Datebase]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.renniaofei.com/?p=949</guid>
		<description><![CDATA[<a href="http://cad2d3d.com/wp-content/uploads/http://renniaofei.com/code/using-php-to-backup-mysql-databases/" title="使用PHP备份MySQL数据库"  class="smallthumb"><img src="http://www.awebgallery.com/wp-content/uploads/http://www.renniaofei.com/wp-content/uploads/2010/05/using-php-to-backup-mysql-databases-thumbnail.jpg" alt="使用PHP备份MySQL数据库" /></a>在网站运营和维护过程中，需要定期对数据进行备份，网站建站方案最经典的搭配组合就是Apache+MySQL+PHP。 使用PHP备份MySQL数据库方法 PHP编程，执行数据库查询备份语句。 使用system() 函数。 使用phpMyAdmin。 一. PHP编程，执行数据库查询备份语句 使用 SELECT INTO OUTFILE  备份数据 &#60;?php include 'config.php'; include 'opendb.php'; $tableName = 'mypet'; $backupFile = 'backup/mypet.sql'; $query = "SELECT * INTO OUTFILE '$backupFile' FROM $tableName"; $result = mysql_query($query); include 'closedb.php'; ?&#62; 使用 LOAD DATA INFILE  来恢复数据 &#60;?php include 'config.php'; include 'opendb.php'; $tableName = 'mypet'; $backupFile = 'mypet.sql'; [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="PHP如何保留2位小数？" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp2-wei-xiaosh%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://renniaofei.com/error/renniaofei-com.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP如何保留2位小数？</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="优化SQL语句，提高数据库执行效率的8条建议" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161932.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">优化SQL语句，提高数据库执行效率的8条建议</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Windows 环境下 PHPnow套件 一键安装 Apache + PHP + MySQL" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/05/21156386.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Windows 环境下 PHPnow套件 一键安装 Apache + PHP + MySQL</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="如何在数据库中一次更新多行多字段" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161936.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何在数据库中一次更新多行多字段</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="[悲剧] PHP $_SESSION 在多个页面之间传递问题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp-session-yemian-chuanzhi-wenti%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21157417.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">[悲剧] PHP $_SESSION 在多个页面之间传递问题</font>
                    </a>
                </td>
        </tr>
        <br/>
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">来自无觅网络的相关文章：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="PHP数据库操作类NotORM中文手册" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.admpub.com%2Fblog%2F%3Fpost%3D201&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/23/33495571.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP数据库操作类NotORM中文手册 (@admpub)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Xeround推出免费版云数据库" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.citydog.me%2F2497.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/02/08/14983828.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Xeround推出免费版云数据库 (@citydog)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP基础语法入门篇（二）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.wozhutou.com%2Farchives%2F273.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/12/12/12259160.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP基础语法入门篇（二） (@wozhutou)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP与浏览器端编程语言" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.wozhutou.com%2Farchives%2F289.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/12/18/12502027.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP与浏览器端编程语言 (@wozhutou)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP中的会话状态控制(一)" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.wozhutou.com%2Farchives%2F331.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/12/28/13170282.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP中的会话状态控制(一) (@wozhutou)</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<a href="http://cad2d3d.com/wp-content/uploads/http://renniaofei.com/code/using-php-to-backup-mysql-databases/" title="使用PHP备份MySQL数据库"  class="smallthumb"><img src="http://www.awebgallery.com/wp-content/uploads/http://www.renniaofei.com/wp-content/uploads/2010/05/using-php-to-backup-mysql-databases-thumbnail.jpg" alt="使用PHP备份MySQL数据库" /></a><p>在网站运营和维护过程中，需要定期对数据进行备份，网站建站方案最经典的搭配组合就是Apache+MySQL+PHP。<br />
<span id="more-949"></span></p>
<h4>使用PHP备份MySQL数据库方法</h4>
<ol>
<li>PHP编程，执行数据库查询备份语句。</li>
<li>使用system() 函数。</li>
<li>使用phpMyAdmin。</li>
</ol>
<h4>一. PHP编程，执行数据库查询备份语句</h4>
<p>使用 SELECT INTO OUTFILE  备份数据</p>
<pre><code>&lt;?php
include 'config.php';
include 'opendb.php';

$tableName  = 'mypet';
$backupFile = 'backup/mypet.sql';
$query      = "SELECT * INTO OUTFILE '$backupFile' FROM $tableName";
$result = mysql_query($query);

include 'closedb.php';
?&gt;</code></pre>
<p>使用 LOAD DATA INFILE  来恢复数据</p>
<pre><code>&lt;?php
include 'config.php';
include 'opendb.php';
$tableName  = 'mypet';
$backupFile = 'mypet.sql';
$query      = "LOAD DATA INFILE 'backupFile' INTO TABLE $tableName";
$result = mysql_query($query);
include 'closedb.php';
?&gt;</code></pre>
<h4>二. 使用system() 函数</h4>
<p>使用MySQL自带的 system()函数执行外部命令（command）。</p>
<pre><code>&lt;?php
include 'config.php';
include 'opendb.php';
$backupFile = $dbname . date("Y-m-d-H-i-s") . '.gz';
$command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip &gt; $backupFile";
system($command);
include 'closedb.php';
?&gt;</code></pre>
<h4>三. 使用phpMyAdmin</h4>
<p>要想使用phpMyAdmin备份数据的前提是你必须等安装它才行。<a href="http://www.phpmyadmin.net/">phpMyAdmin 下载地址</a></p>
<p>具体步骤：phpMyAdmin主页 / 导出 / 选择需要导出的数据表 /选项默认即可 / 执行</p>
<p><a href="http://www.php-mysql-tutorial.com/wikis/mysql-tutorials/default.aspx">来源</a></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="PHP如何保留2位小数？" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp2-wei-xiaosh%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://renniaofei.com/error/renniaofei-com.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP如何保留2位小数？</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="优化SQL语句，提高数据库执行效率的8条建议" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161932.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">优化SQL语句，提高数据库执行效率的8条建议</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Windows 环境下 PHPnow套件 一键安装 Apache + PHP + MySQL" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/05/21156386.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Windows 环境下 PHPnow套件 一键安装 Apache + PHP + MySQL</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="如何在数据库中一次更新多行多字段" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161936.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何在数据库中一次更新多行多字段</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="[悲剧] PHP $_SESSION 在多个页面之间传递问题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp-session-yemian-chuanzhi-wenti%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21157417.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">[悲剧] PHP $_SESSION 在多个页面之间传递问题</font>
                    </a>
                </td>
        </tr>
        <br/>
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">来自无觅网络的相关文章：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="PHP数据库操作类NotORM中文手册" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.admpub.com%2Fblog%2F%3Fpost%3D201&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/23/33495571.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP数据库操作类NotORM中文手册 (@admpub)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Xeround推出免费版云数据库" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.citydog.me%2F2497.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2012/02/08/14983828.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Xeround推出免费版云数据库 (@citydog)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP基础语法入门篇（二）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.wozhutou.com%2Farchives%2F273.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/12/12/12259160.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP基础语法入门篇（二） (@wozhutou)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP与浏览器端编程语言" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.wozhutou.com%2Farchives%2F289.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/12/18/12502027.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP与浏览器端编程语言 (@wozhutou)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP中的会话状态控制(一)" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.wozhutou.com%2Farchives%2F331.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/12/28/13170282.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP中的会话状态控制(一) (@wozhutou)</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://renniaofei.com/code/using-php-to-backup-mysql-databases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>优化SQL语句，提高数据库执行效率的8条建议</title>
		<link>http://renniaofei.com/code/8-useful-tips-to-optimize-and-speed-up-your-website-database/</link>
		<comments>http://renniaofei.com/code/8-useful-tips-to-optimize-and-speed-up-your-website-database/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 17:53:14 +0000</pubDate>
		<dc:creator>任鸟飞</dc:creator>
				<category><![CDATA[编码]]></category>
		<category><![CDATA[Datebase]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[技巧]]></category>

		<guid isPermaLink="false">http://www.renniaofei.com/?p=625</guid>
		<description><![CDATA[<a href="http://cad2d3d.com/wp-content/uploads/http://renniaofei.com/code/8-useful-tips-to-optimize-and-speed-up-your-website-database/" title="优化SQL语句，提高数据库执行效率的8条建议"  class="smallthumb"><img src="http://www.awebgallery.com/wp-content/uploads/http://www.renniaofei.com/wp-content/uploads/2010/03/8-useful-tips-to-optimize-and-speed-up-your-website-database-thumbnail.jpg" alt="优化SQL语句，提高数据库执行效率的8条建议" /></a>网站（动态）的数据一般情况下都会存储在数据库中（例如MS SQL、My SQL等），当用户访问网站时，会根据一些缺省的或用户提交的参数（比如网址后面可能会带有”index.php?cat=design” ）来查询或更新数据库，虽然数据库的运行速度很快，但在一些不恰当的数据库操作的情况下，会增加数据库运行占用的系统资源，严重时可能会拖垮整个数据库的运行。 下面汇总了10条常见的SQL语句问题点及优化建议 1. 尽量减少 * 的使用，只查询你需要的字段内容。 优化前： SELECT * FROM wp_posts; 优化后： SELECT title, excerpt, author FROM wp_posts; 2. 记得使用 LIMIT ， 限制查询的数量。 优化后： SELECT title, excerpt, author FROM wp_posts LIMIT 10; LIMIT 的使用方法： LIMIT OFFSET,NUMBER ； offset代表偏移量，number代表从offset开始查询的数量。 例如： LIMIT 10 ； 代表偏移量为0，查询条数为10条。 LIMIT 10,12 ; 代表偏移量为10，查询条数为12条。 3. 避免在程序语言的循环语句（例如 PHP 的foreach、while 等）中使用SQL语句 [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="使用PHP备份MySQL数据库" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161926.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用PHP备份MySQL数据库</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP如何保留2位小数？" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp2-wei-xiaosh%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://renniaofei.com/error/renniaofei-com.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP如何保留2位小数？</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="提高WordPress安全性必须掌握的5种方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Ftop-5-wordpress-security-tips%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161903.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">提高WordPress安全性必须掌握的5种方法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Windows 环境下 PHPnow套件 一键安装 Apache + PHP + MySQL" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/05/21156386.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Windows 环境下 PHPnow套件 一键安装 Apache + PHP + MySQL</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="如何在数据库中一次更新多行多字段" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161936.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何在数据库中一次更新多行多字段</font>
                    </a>
                </td>
        </tr>
        <br/>
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">来自无觅网络的相关文章：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="常用SQL——Row_Number" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.admpub.com%2Fpost-137.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/23/33495571.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">常用SQL——Row_Number (@admpub)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP数据库操作类NotORM中文手册" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.admpub.com%2Fblog%2Fpost-201.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/23/33495571.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP数据库操作类NotORM中文手册 (@admpub)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP性能优化技巧" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.admpub.com%2Fpost-70.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/23/33495571.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP性能优化技巧 (@admpub)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="如何提高PHP编程效率" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.admpub.com%2Fblog%2Fpost-1.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/23/33495571.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何提高PHP编程效率 (@admpub)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="(转载)php用fsockopen()函数实现模拟提交表单" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.admpub.com%2Fpost-56.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/23/33495571.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">(转载)php用fsockopen()函数实现模拟提交表单 (@admpub)</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<a href="http://cad2d3d.com/wp-content/uploads/http://renniaofei.com/code/8-useful-tips-to-optimize-and-speed-up-your-website-database/" title="优化SQL语句，提高数据库执行效率的8条建议"  class="smallthumb"><img src="http://www.awebgallery.com/wp-content/uploads/http://www.renniaofei.com/wp-content/uploads/2010/03/8-useful-tips-to-optimize-and-speed-up-your-website-database-thumbnail.jpg" alt="优化SQL语句，提高数据库执行效率的8条建议" /></a><p>网站（动态）的数据一般情况下都会存储在数据库中（例如MS SQL、My SQL等），当用户访问网站时，会根据一些缺省的或用户提交的参数（比如网址后面可能会带有”index.php?cat=design” ）来查询或更新数据库，虽然数据库的运行速度很快，但在一些不恰当的数据库操作的情况下，会增加数据库运行占用的系统资源，严重时可能会拖垮整个数据库的运行。<br />
<span id="more-625"></span><br />
下面汇总了10条常见的SQL语句问题点及优化建议</p>
<h4>1.  尽量减少 * 的使用，只查询你需要的字段内容。</h4>
<p>优化前：</p>
<pre><code>SELECT * FROM wp_posts;</code></pre>
<p>优化后：</p>
<pre><code>SELECT title, excerpt, author FROM wp_posts;</code></pre>
<h4>2. 记得使用 LIMIT ， 限制查询的数量。</h4>
<p>优化后：</p>
<pre><code>SELECT title, excerpt, author FROM wp_posts LIMIT 10;</code></pre>
<p>LIMIT 的使用方法：<br />
LIMIT OFFSET,NUMBER ； offset代表偏移量，number代表从offset开始查询的数量。<br />
例如：<br />
LIMIT 10 ； 代表偏移量为0，查询条数为10条。<br />
LIMIT 10,12 ; 代表偏移量为10，查询条数为12条。</p>
<h4>3. 避免在程序语言的循环语句（例如 PHP 的foreach、while 等）中使用SQL语句</h4>
<p>优化前:</p>
<pre><code>foreach ($display_order as $id =&gt; $ordinal) {
$sql = "UPDATE categories SET display_order = $ordinal WHERE id = $id";}</code></pre>
<p>优化后：</p>
<pre><code>UPDATE categories
SET display_order =   CASE id
WHEN 1 THEN 3
WHEN 2 THEN 4
WHEN 3 THEN 5
END
WHERE id IN (1,2,3)</code></pre>
<p>具体请参考：<a href="http://www.renniaofei.com/code/update-multiple-rows-with-different-values-and-a-single-sql-query/">如何在数据库中一次更新多行多字段</a></p>
<h4>4. 使用join代替子查询（subqueries）语句</h4>
<p>优化前：</p>
<pre><code>SELECT a.id,
(SELECT MAX(created)
FROM posts
WHERE author_id = a.id)
AS latest_post FROM authors a</code></pre>
<p>优化后：</p>
<pre><code>SELECT a.id, MAX(p.created) AS latest_post
FROM authors a
INNER JOIN posts p
ON (a.id = p.author_id)
GROUP BY a.id </code></pre>
<h4>5. 尽量减少通配符的使用，特别是前缀通配符（通配符放在前面）</h4>
<pre><code>#Full wildcard
SELECT * FROM TABLE WHERE COLUMN LIKE '%hello%';
#Postfix wildcard
SELECT * FROM TABLE WHERE COLUMN LIKE  'hello%';
#Prefix wildcard
SELECT * FROM TABLE WHERE COLUMN LIKE  '%hello';</code></pre>
<h4>6. 使用union代替or查询语句</h4>
<p>优化前：</p>
<pre><code>SELECT * FROM a, b WHERE a.p = b.q or a.x = b.y;</code></pre>
<p>优化后</p>
<pre><code>SELECT * FROM a, b WHERE a.p = b.q
UNION
SELECT * FROM a, b WHERE a.x = b.y</code></pre>
<h4>7. 记得使用索引（index）</h4>
<pre><code>CREATE INDEX idxModel ON Product (Model);</code></pre>
<h4>8. 用&gt;=替代&gt;</h4>
<p>优化前：</p>
<pre><code>SELECT * FROM EMP WHERE DEPTNO &gt;3</code></pre>
<p>优化后：</p>
<pre><code>SELECT * FROM EMP WHERE DEPTNO &gt;=4</code></pre>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="使用PHP备份MySQL数据库" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161926.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用PHP备份MySQL数据库</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP如何保留2位小数？" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp2-wei-xiaosh%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://renniaofei.com/error/renniaofei-com.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP如何保留2位小数？</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="提高WordPress安全性必须掌握的5种方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Ftop-5-wordpress-security-tips%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161903.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">提高WordPress安全性必须掌握的5种方法</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Windows 环境下 PHPnow套件 一键安装 Apache + PHP + MySQL" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/05/21156386.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Windows 环境下 PHPnow套件 一键安装 Apache + PHP + MySQL</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="如何在数据库中一次更新多行多字段" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161936.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何在数据库中一次更新多行多字段</font>
                    </a>
                </td>
        </tr>
        <br/>
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">来自无觅网络的相关文章：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="常用SQL——Row_Number" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.admpub.com%2Fpost-137.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/23/33495571.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">常用SQL——Row_Number (@admpub)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP数据库操作类NotORM中文手册" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.admpub.com%2Fblog%2Fpost-201.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/23/33495571.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP数据库操作类NotORM中文手册 (@admpub)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP性能优化技巧" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.admpub.com%2Fpost-70.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/23/33495571.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP性能优化技巧 (@admpub)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="如何提高PHP编程效率" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.admpub.com%2Fblog%2Fpost-1.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/23/33495571.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何提高PHP编程效率 (@admpub)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="(转载)php用fsockopen()函数实现模拟提交表单" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.admpub.com%2Fpost-56.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/23/33495571.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">(转载)php用fsockopen()函数实现模拟提交表单 (@admpub)</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://renniaofei.com/code/8-useful-tips-to-optimize-and-speed-up-your-website-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>如何在数据库中一次更新多行多字段</title>
		<link>http://renniaofei.com/code/update-multiple-rows-with-different-values-and-a-single-sql-query/</link>
		<comments>http://renniaofei.com/code/update-multiple-rows-with-different-values-and-a-single-sql-query/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 07:06:22 +0000</pubDate>
		<dc:creator>任鸟飞</dc:creator>
				<category><![CDATA[编码]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.renniaofei.com/?p=611</guid>
		<description><![CDATA[<a href="http://cad2d3d.com/wp-content/uploads/http://renniaofei.com/code/update-multiple-rows-with-different-values-and-a-single-sql-query/" title="如何在数据库中一次更新多行多字段"  class="smallthumb"><img src="http://www.awebgallery.com/wp-content/uploads/http://www.renniaofei.com/wp-content/uploads/2010/03/update-multiple-rows-with-different-values-and-a-single-sql-query-thumbnail.jpg" alt="如何在数据库中一次更新多行多字段" /></a>数据库操作中经常会遇到需要更新多个行、多个字段的操作，这里介绍一种结构清晰的SQL语句，以期能提高数据库操作效率，并尽可能降低系统资源的消耗。 我们先看一个常见的SQL UPDATE语句的写法： UPDATE mytable SET myfield = 'value' WHERE other_field = 'other_value'; 在更新多行操作，常见的SQL UPDATE写法可能如下所示（PHP环境下）： foreach ($display_order as $id =&#62; $ordinal) { $sql = "UPDATE categories SET display_order = $ordinal WHERE id = $id"; mysql_query($sql); } 上述代码虽然也能达到我们期待的结果，但很显然，上述代码多次执行数据库更新（UPDATE）操作，当更新行数较多时，将严重占用系统资源。 改进后的数据库更新（UPDATE）操作 UPDATE mytable SET myfield = CASE other_field WHEN 1 THEN 'value' WHEN 2 THEN 'value' WHEN 3 [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="使用PHP备份MySQL数据库" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161926.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用PHP备份MySQL数据库</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Windows 环境下 PHPnow套件 一键安装 Apache + PHP + MySQL" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/05/21156386.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Windows 环境下 PHPnow套件 一键安装 Apache + PHP + MySQL</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="优化SQL语句，提高数据库执行效率的8条建议" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161932.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">优化SQL语句，提高数据库执行效率的8条建议</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP如何保留2位小数？" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp2-wei-xiaosh%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://renniaofei.com/error/renniaofei-com.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP如何保留2位小数？</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="[悲剧] PHP $_SESSION 在多个页面之间传递问题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp-session-yemian-chuanzhi-wenti%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21157417.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">[悲剧] PHP $_SESSION 在多个页面之间传递问题</font>
                    </a>
                </td>
        </tr>
        <br/>
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">来自无觅网络的相关文章：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="PHP数据库操作类NotORM中文手册" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.admpub.com%2Fblog%2Fpost-201.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/23/33495571.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP数据库操作类NotORM中文手册 (@admpub)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="php代码解密一法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.99psn.com%2F1617.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/10/29971995.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">php代码解密一法 (@99psn)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP中的会话状态控制(一)" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.wozhutou.com%2Farchives%2F331.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/12/28/13170282.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP中的会话状态控制(一) (@wozhutou)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="常用SQL——Row_Number" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.admpub.com%2Fpost-137.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/23/33495571.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">常用SQL——Row_Number (@admpub)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP header 重定向 UTF-8编码 报错" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.buicaa.com%2Farticle%2Fphp-header-redirect%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/08/10441549.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP header 重定向 UTF-8编码 报错 (@buicaa)</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<a href="http://cad2d3d.com/wp-content/uploads/http://renniaofei.com/code/update-multiple-rows-with-different-values-and-a-single-sql-query/" title="如何在数据库中一次更新多行多字段"  class="smallthumb"><img src="http://www.awebgallery.com/wp-content/uploads/http://www.renniaofei.com/wp-content/uploads/2010/03/update-multiple-rows-with-different-values-and-a-single-sql-query-thumbnail.jpg" alt="如何在数据库中一次更新多行多字段" /></a><p>数据库操作中经常会遇到需要更新多个行、多个字段的操作，这里介绍一种结构清晰的SQL语句，以期能提高数据库操作效率，并尽可能降低系统资源的消耗。<br />
<span id="more-611"></span></p>
<h4>我们先看一个常见的SQL UPDATE语句的写法：</h4>
<pre><code>UPDATE mytable SET   myfield = 'value' WHERE other_field = 'other_value';</code></pre>
<h4>在更新多行操作，常见的SQL UPDATE写法可能如下所示（PHP环境下）：</h4>
<pre><code>foreach ($display_order   as $id =&gt; $ordinal) {
$sql = "UPDATE categories SET display_order = $ordinal   WHERE id = $id";
mysql_query($sql);
}</code></pre>
<p>上述代码虽然也能达到我们期待的结果，但很显然，上述代码多次执行数据库更新（UPDATE）操作，当更新行数较多时，将严重占用系统资源。</p>
<h4>改进后的数据库更新（UPDATE）操作</h4>
<pre><code>UPDATE mytable
 SET myfield = CASE   other_field
 WHEN 1 THEN 'value'
 WHEN 2 THEN 'value'
 WHEN 3 THEN 'value'
END
 WHERE id IN (1,2,3)</code></pre>
<p>经过改进后的上述代码也能实现更新多行的目标，而且更新操作是在一条更新语句中完成，大大降低了数据库更新操作占用的系统资源。</p>
<p><strong>代码说明：</strong></p>
<p>SET myfield = CASE   other_field  &#8211; 使用CASE语句代替具体的字段值。<br />
WHEN 1 THEN &#8216;value&#8217;  &#8211; 根据条件（在本例中的判断条件就是id）更新对应的字段.<br />
WHERE id IN (1,2,3)  &#8211; 指定查询范围，可省略（不推荐） 。</p>
<p><strong>示例</strong></p>
<pre><code>UPDATE categories
SET display_order =   CASE id
 WHEN 1 THEN 3
 WHEN 2 THEN 4
 WHEN 3 THEN 5
END
 WHERE id IN (1,2,3)</code></pre>
<p><strong>更新多行多字段的SQL UPDATE语句，只要相应的增加CASE语句即可。</strong></p>
<pre><code>
UPDATE categories
 SET display_order =   CASE id
 WHEN 1 THEN 3
 WHEN 2 THEN 4
 WHEN 3 THEN 5
END,
 title = CASE id
 WHEN 1 THEN 'New   Title 1'
 WHEN 2 THEN 'New   Title 2'
 WHEN 3 THEN 'New   Title 3'
END
 WHERE id IN (1,2,3)</code></pre>
<h4>在实际应用中可以参考如下代码（PHP环境下）:</h4>
<pre><code>//新建一个数组display_order， 按键值的方式给数组初始化（category ids 作为键 ，赋予新的次序）
 $display_order = array(
 1 =&gt; 4,
 2 =&gt; 1,
 3 =&gt; 2,
 4 =&gt; 3,
 5 =&gt; 9,
 6 =&gt; 5,
 7 =&gt; 8,
 8 =&gt; 9
);
 $ids = implode(',', array_keys($display_order));
 $sql = "UPDATE categories SET display_order = CASE id ";
foreach ($display_order as $id =&gt; $ordinal) {
 $sql .= sprintf("WHEN   %d THEN %d ", $id,   $ordinal);
}
 $sql .= "END WHERE id IN ($ids)";
 echo $sql;</code></pre>
<p>运用上述方法，在更新成千上万行的数据时，将大大提高数据库操作效率，并降低系统资源消耗。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="使用PHP备份MySQL数据库" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fusing-php-to-backup-mysql-databases%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161926.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用PHP备份MySQL数据库</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Windows 环境下 PHPnow套件 一键安装 Apache + PHP + MySQL" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Finternet%2Fphpnow-apache-php-mysql%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/05/21156386.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Windows 环境下 PHPnow套件 一键安装 Apache + PHP + MySQL</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="优化SQL语句，提高数据库执行效率的8条建议" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2F8-useful-tips-to-optimize-and-speed-up-your-website-database%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21161932.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">优化SQL语句，提高数据库执行效率的8条建议</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP如何保留2位小数？" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp2-wei-xiaosh%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://renniaofei.com/error/renniaofei-com.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP如何保留2位小数？</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="[悲剧] PHP $_SESSION 在多个页面之间传递问题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Frenniaofei.com%2Fcode%2Fphp-session-yemian-chuanzhi-wenti%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/29/21157417.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">[悲剧] PHP $_SESSION 在多个页面之间传递问题</font>
                    </a>
                </td>
        </tr>
        <br/>
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">来自无觅网络的相关文章：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="PHP数据库操作类NotORM中文手册" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.admpub.com%2Fblog%2Fpost-201.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/23/33495571.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP数据库操作类NotORM中文手册 (@admpub)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="php代码解密一法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.99psn.com%2F1617.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/10/29971995.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">php代码解密一法 (@99psn)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP中的会话状态控制(一)" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.wozhutou.com%2Farchives%2F331.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/12/28/13170282.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP中的会话状态控制(一) (@wozhutou)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="常用SQL——Row_Number" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.admpub.com%2Fpost-137.html&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/23/33495571.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">常用SQL——Row_Number (@admpub)</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP header 重定向 UTF-8编码 报错" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.buicaa.com%2Farticle%2Fphp-header-redirect%2F&from=http%3A%2F%2Frenniaofei.com%2Fcode%2Fupdate-multiple-rows-with-different-values-and-a-single-sql-query%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/11/08/10441549.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP header 重定向 UTF-8编码 报错 (@buicaa)</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://renniaofei.com/code/update-multiple-rows-with-different-values-and-a-single-sql-query/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: renniaofei.com @ 2012-02-10 05:07:12 -->
