





<?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>爱上梁坤,爱上你</title>
	<atom:link href="http://www.liangkun.net/feed" rel="self" type="application/rss+xml" />
	<link>http://www.liangkun.net</link>
	<description>死生契阔，与子成说。执子之手，与子偕老。--------诗经</description>
	<lastBuildDate>Wed, 09 May 2012 11:06:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>关于需求沟通那些年那些事</title>
		<link>http://www.liangkun.net/archives/813.html</link>
		<comments>http://www.liangkun.net/archives/813.html#comments</comments>
		<pubDate>Wed, 09 May 2012 11:06:41 +0000</pubDate>
		<dc:creator>zhang</dc:creator>
				<category><![CDATA[web开发]]></category>
		<category><![CDATA[梁言坤语]]></category>
		<category><![CDATA[需求]]></category>

		<guid isPermaLink="false">http://www.liangkun.net/?p=813</guid>
		<description><![CDATA[负责设计的同事，很容易就搞了几个界面效果，发给客户看，客户还算满意，顺便还夸了我们几句，不过提议要绿色的。农业局吗，绿色的能表现农业，可以理解。 改了一套绿色的，送过去。人家不满意，提了几个意见。改了又送过去，又不满意；又改，还不满意。美工郁闷了，开始嘟囔，“为什么一开始挺满意，越做反而意 见越多，我这么多天，是不是白干了？客户整个就是没事儿找茬，他要做什么，我就做什么，还是不满意。肯定是觉得我们做得太快了，我们应该拖一拖，让他们觉 得这个工作很难做。” 工作速度越来越慢。客户也越来越不满意，眼看这活儿要黄。 趁工作间隙，我说，“我给你说说咋回事儿，你看对不？ “农业局要绿色的，这个可以理解，但是他要绿的，你就给他绿的，绿也有很多种啊。 春天的嫩绿，夏天的深绿，秋天的灰绿，冬天的墨绿，客户要哪一种呢？ “或许，他们要的只是春天的感觉，要的是生机盎然，而不是绿，姹紫嫣红都是春，绿不并是关键。只不过，客户不知道如何表达罢了。第一次客户只看到一个粗略 的架构，他们并不是满意了，而是相信我们会进一步精化界面，我们不应该放松心态，而应该心存感激。可是后来的设计思路与他们想的并不一样，就着急了，也觉 得我们辜负了他们的信任，态度开始不友好。所以，现在最好调整思路，不要沿着客户的描述惟命是从，而应该认真分析客户言语背后的真正意图。关于春天的思 路，你试试吧，说不定可以哩。” 美工哼哼叽叽不想动，不过也实在没有别的路子，只能拿我的方法试试。 结果，一下就通过了，客户很高兴，说，这就是我想要的。不过，仍提不了少意见。 我告诉美工，现在通过的只是色彩风格，布局能否满意还是个问题，到时，又提一堆细节问题，你改来改去，原本好的设计就改乱了，最终效果不好看，还会怪你。 你最好跟客户沟通一下，看他们喜欢什么样的布局，是喜欢韩式的呀，还是欧式，还是中式的？韩式的都是大图顶头，炫、靓；欧式的超简捷，除了logo之外几 乎没有图片；中式的吗，上面是图片，下面一拉不见底，全是文字，就像新浪那样的。 又设计三套，客户选了“中式”的，然后象征性的提了几个意见。真正的程序制作倒不费劲，现有的程序往上一套就行了，两天就搞定，而且兼容所有主流浏览器。 经过这个事情，让我想起项目管理中的一个经典案例，“客户说想要个月亮，怎么办？” 客户说想要什么就要什么，那还得了？客户不是上帝，只不过是财神爷。 需求分析的目的，就是搞清楚客户的真实需求，而不是他张嘴就说的“要什么”。那只是表面现象。 问客户，你要月亮干什么呀？ 客户说，我晚上怕黑？ 那给你修路灯行不行呀？ 客户说，俺家在乡下，没电 那就他给建议，你看，我们公司有个产品，轻便小巧，可以随身携带，能够室内室外全天候使用，一个100块钱，给你打八折优惠，你看怎么样？ OK，10块钱买一个，卖给他就行了。 赚的70元钱，就是需求分析的价值。需求分析不是客户要什么，我们给什么，而是要知道客户在想什么，这样我们才知道做什么。 经常听一些程序员说，某某软件，那么简单，只是增删改查而已，就能卖几十万，肯定是关系户，一脸的不屑。要知道，人家的价值，就是能真正精准的理解用户需求，快速实现预期目标。 技术的确很简单，你也可以做，但在不明晰需求的情况下，做个试试？返工两回，你的成本就超支了，这个时候，你就不会觉得几十万贵了，而会觉得亏。 随机推荐文章SVN的服务器端和客户端安装配置 以及与MyEclipse 整合使用php函数call_user_func和call_user_func_array详解 英文网站如何一步步获取流量linux的chmod与chown命令使用及区别前腾讯员工离职三个月开发出 app store排名第一应用疯狂猎鸟的总结百万级PHP网站架构《高性能网站建设指南》笔记什么是UE、UI、UCD、UED？UE、UI、UCD、UED四者的区别 MySQL性能调优与架构设计32位 与 64 位的区别 php<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="正确的写产品需求文档" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F743.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F813.html">
                        <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;">正确的写产品需求文档</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="一个典型支付系统的设计与实现" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F637.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F813.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/03/10752764.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">一个典型支付系统的设计与实现</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="wordpress中为文章加上访问密码" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F624.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F813.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/08/11395796.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">wordpress中为文章加上访问密码</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP5和Zend Optimizer 基础安装教程" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F89.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F813.html">
                        <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/05/04/7493052.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;">PHP5和Zend Optimizer 基础安装教程</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="使用google广告管理系统免费管理您的广告" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F73.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F813.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/17/16239228.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;">使用google广告管理系统免费管理您的广告</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>负责设计的同事，很容易就搞了几个界面效果，发给客户看，客户还算满意，顺便还夸了我们几句，不过提议要绿色的。农业局吗，绿色的能表现农业，可以理解。</p>
<p>改了一套绿色的，送过去。人家不满意，提了几个意见。改了又送过去，又不满意；又改，还不满意。美工郁闷了，开始嘟囔，“为什么一开始挺满意，越做反而意 见越多，我这么多天，是不是白干了？客户整个就是没事儿找茬，他要做什么，我就做什么，还是不满意。肯定是觉得我们做得太快了，我们应该拖一拖，让他们觉 得这个工作很难做。”</p>
<p>工作速度越来越慢。客户也越来越不满意，眼看这活儿要黄。</p>
<p>趁工作间隙，我说，“我给你说说咋回事儿，你看对不？</p>
<p>“农业局要绿色的，这个可以理解，但是他要绿的，你就给他绿的，绿也有很多种啊。</p>
<p>春天的嫩绿，夏天的深绿，秋天的灰绿，冬天的墨绿，客户要哪一种呢？</p>
<p>“或许，他们要的只是春天的感觉，要的是生机盎然，而不是绿，姹紫嫣红都是春，绿不并是关键。只不过，客户不知道如何表达罢了。第一次客户只看到一个粗略 的架构，他们并不是满意了，而是相信我们会进一步精化界面，我们不应该放松心态，而应该心存感激。可是后来的设计思路与他们想的并不一样，就着急了，也觉 得我们辜负了他们的信任，态度开始不友好。所以，现在最好调整思路，不要沿着客户的描述惟命是从，而应该认真分析客户言语背后的真正意图。关于春天的思 路，你试试吧，说不定可以哩。”<br />
<span id="more-813"></span><br />
美工哼哼叽叽不想动，不过也实在没有别的路子，只能拿我的方法试试。</p>
<p>结果，一下就通过了，客户很高兴，说，这就是我想要的。不过，仍提不了少意见。</p>
<p>我告诉美工，现在通过的只是色彩风格，布局能否满意还是个问题，到时，又提一堆细节问题，你改来改去，原本好的设计就改乱了，最终效果不好看，还会怪你。 你最好跟客户沟通一下，看他们喜欢什么样的布局，是喜欢韩式的呀，还是欧式，还是中式的？韩式的都是大图顶头，炫、靓；欧式的超简捷，除了logo之外几 乎没有图片；中式的吗，上面是图片，下面一拉不见底，全是文字，就像新浪那样的。</p>
<p>又设计三套，客户选了“中式”的，然后象征性的提了几个意见。真正的程序制作倒不费劲，现有的程序往上一套就行了，两天就搞定，而且兼容所有主流浏览器。</p>
<p>经过这个事情，让我想起项目管理中的一个经典案例，“客户说想要个月亮，怎么办？”</p>
<p>客户说想要什么就要什么，那还得了？客户不是上帝，只不过是财神爷。</p>
<p>需求分析的目的，就是搞清楚客户的真实需求，而不是他张嘴就说的“要什么”。那只是表面现象。</p>
<p>问客户，你要月亮干什么呀？</p>
<p>客户说，我晚上怕黑？</p>
<p>那给你修路灯行不行呀？</p>
<p>客户说，俺家在乡下，没电</p>
<p>那就他给建议，你看，我们公司有个产品，轻便小巧，可以随身携带，能够室内室外全天候使用，一个100块钱，给你打八折优惠，你看怎么样？</p>
<p>OK，10块钱买一个，卖给他就行了。</p>
<p>赚的70元钱，就是需求分析的价值。需求分析不是客户要什么，我们给什么，而是要知道客户在想什么，这样我们才知道做什么。</p>
<p>经常听一些程序员说，某某软件，那么简单，只是增删改查而已，就能卖几十万，肯定是关系户，一脸的不屑。要知道，人家的价值，就是能真正精准的理解用户需求，快速实现预期目标。</p>
<p>技术的确很简单，你也可以做，但在不明晰需求的情况下，做个试试？返工两回，你的成本就超支了，这个时候，你就不会觉得几十万贵了，而会觉得亏。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="正确的写产品需求文档" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F743.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F813.html">
                        <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;">正确的写产品需求文档</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="session和cookie原理及使用小结" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F93.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F813.html">
                        <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/05/04/7492795.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;">session和cookie原理及使用小结</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="什么是VPS（Virtual Private Server 虚拟专用服务器）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F271.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F813.html">
                        <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/05/04/7492714.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;">什么是VPS（Virtual Private 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="如何让你的WordPress留言显示自定义头像" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F77.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F813.html">
                        <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/05/08/7989207.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何让你的WordPress留言显示自定义头像</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="前腾讯员工离职三个月开发出 app store排名第一应用疯狂猎鸟的总结" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F746.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F813.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/10/22/9608360.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">前腾讯员工离职三个月开发出 app store排名第一应用疯狂猎鸟的总结</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><h2  class="related_post_title">随机推荐文章</h2><ul class="related_post"><li><a href="http://www.liangkun.net/archives/244.html" title="SVN的服务器端和客户端安装配置 以及与MyEclipse 整合使用">SVN的服务器端和客户端安装配置 以及与MyEclipse 整合使用</a></li><li><a href="http://www.liangkun.net/archives/559.html" title="PHP获取163邮箱联系人">PHP获取163邮箱联系人</a></li><li><a href="http://www.liangkun.net/archives/1.html" title="Hello world！">Hello world！</a></li><li><a href="http://www.liangkun.net/archives/232.html" title="linux下的rz及sz的安装及使用说明">linux下的rz及sz的安装及使用说明</a></li><li><a href="http://www.liangkun.net/archives/454.html" title="以实例说明域名A记录与泛解析的联系与区别">以实例说明域名A记录与泛解析的联系与区别</a></li><li><a href="http://www.liangkun.net/archives/647.html" title="妙用hosts文件">妙用hosts文件</a></li><li><a href="http://www.liangkun.net/archives/280.html" title="dedecms系统中arclist标签使用方法详解">dedecms系统中arclist标签使用方法详解</a></li><li><a href="http://www.liangkun.net/archives/429.html" title="[MySQL] 主键和外键的设计原则">[MySQL] 主键和外键的设计原则</a></li><li><a href="http://www.liangkun.net/archives/483.html" title="Discuz7.0程序二次开发必备：目录详解">Discuz7.0程序二次开发必备：目录详解</a></li><li><a href="http://www.liangkun.net/archives/743.html" title="正确的写产品需求文档">正确的写产品需求文档</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.liangkun.net/archives/813.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>apache 优化配置几条建议</title>
		<link>http://www.liangkun.net/archives/806.html</link>
		<comments>http://www.liangkun.net/archives/806.html#comments</comments>
		<pubDate>Sun, 06 May 2012 15:47:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://www.liangkun.net/?p=806</guid>
		<description><![CDATA[1.控制MaxClients的设置，以避免服务器产生太多的子进程而发生交换。 进程间的数据交换会占用很大内存，数据交换产生的滞后使用户总感觉”不够快”，所以用户就可能去按”停止”和”刷新”，从而带来更大的负载。一般建议小网站将MaxClients设置为12~24。 2.选择更好的硬件，CPU、内存、硬盘等等 这句很鸡肋啦，如果有更多的银子，谁不愿意换更好的呢？^_^ 3.定期更新操作系统，打上系统补丁；如果你的操作系统支持sendfile()系统调用，则务必安装带有此功能的版本或补丁 在支持sendfile的系统中，Apache2可以更快地发送静态内容而且占用较少的CPU时间。 4.HostnameLookups设置为off 尽量较少DNS查询的次数。如果你使用了任何”Allow from domain”或”Deny from domain”指令(也就是domain使用的是主机名而不是IP地址)，则代价是要进行两次DNS查询(一次正向和一次反向，以确认没有作假)。所以， 为了得到最高的性能，应该避免使用这些指令(不用域名而用IP地址也是可以的)。 5.为Directory加上FollowSymLinks 如果网站空间中没有使用 Options FollowSymLinks ，Apache就必须执行额外的系统调用以验证符号连接。例如：在请求”/index.html”时，Apache将对”/www”、”/www /htdocs”、”/www/htdocs/index.html”执行lstat()调用。而且lstat()的执行结果不被缓存，因此对每一个请求 都要执行一次。 6.将AllowOverride设置为None 对于使用虚拟主机的朋友可能会觉得不方便，这样设置将会使.htaccess中的设置失效，如果实在需要，并且在有条件的情况下，请在conf配置文件中直接写入rewrite规则 7.禁用内容协商 尽管在实践中，内容协商的好处大于性能的损失，如果你很在意那一点点的性能损失，则可以禁止使用内容协商。但是仍然有个方法可以提高服务器的速度，就是不要使用通配符。 8.MaxRequestsPerChild设置为非0以防止内存泄漏 MaxRequestsPerChild用于控制apache子进程在何时销毁，默认为0，代表永不销毁子进程，这可能会存在内存泄漏的风险，建议设置为10000 9.KeepAlive与KeepAliveTimeOut 如果你使用的使mpm_prefork模式(apache默认安装)，那么建议你将KeepAlive设置为off；因为，开启keepalive会为每 个客户端建立一个连接，prefork不会创建线程，估计100个用户同时访问你的网站，apache就会挂了～，如果你实在想开启，那么请将 KeepAliveTimeOut 时间设置更短些，例如5，默认是60秒呢 10.不要静态编译apache 尽管会有很多人和你说静态编译的好处，同时，你自己也想自己编译一把，以体验乐趣～但是，将模块已静态方式编译进apache绝对不是一个好选择，尤其是对于缺银子的站长们来说，一个配置不当，apache会在启动时就占用光你所有的内存，最后拖垮服务器～ 转自：http://www.cnphp.info/10-tips-for-optimize-apache-options.html 【相关文章推荐】如何在PHP网站开发中，指定任意文件扩展名使用PHP解析<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="如何在PHP网站开发中，指定任意文件扩展名使用PHP解析" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F16.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F806.html">
                        <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/05/04/7493183.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何在PHP网站开发中，指定任意文件扩展名使用PHP解析</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="Apache Rewrite 规则详细解释" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F568.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F806.html">
                        <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;">Apache Rewrite 规则详细解释</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="[技巧] Mysql数据库优化技术—配置篇" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F649.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F806.html">
                        <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;">[技巧] Mysql数据库优化技术—配置篇</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="SVN的服务器端和客户端安装配置 以及与MyEclipse 整合使用" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F244.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F806.html">
                        <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;">SVN的服务器端和客户端安装配置 以及与MyEclipse 整合使用</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="SVN版本库中conf下配置文件详细说明" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F261.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F806.html">
                        <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;">SVN版本库中conf下配置文件详细说明</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[<ol>
<li><span style="color: #000000;">1.控制MaxClients的设置，以避免服务器产生太多的子进程而发生交换。</span><br />
<span style="color: #000000;"> 进程间的数据交换会占用很大内存，数据交换产生的滞后使用户总感觉”不够快”，所以用户就可能去按”停止”和”刷新”，从而带来更大的负载。一般建议小网站将MaxClients设置为12~24。</span></li>
<li></li>
<li><span style="color: #000000;">2.选择更好的硬件，CPU、内存、硬盘等等</span><br />
<span style="color: #000000;"> 这句很鸡肋啦，如果有更多的银子，谁不愿意换更好的呢？^_^</span></li>
<li></li>
<li><span style="color: #000000;">3.定期更新操作系统，打上系统补丁；如果你的操作系统支持sendfile()系统调用，则务必安装带有此功能的版本或补丁</span><br />
<span style="color: #000000;"> 在支持sendfile的系统中，Apache2可以更快地发送静态内容而且占用较少的CPU时间。</span></li>
<li></li>
<li><span style="color: #000000;">4.HostnameLookups设置为off</span><br />
<span style="color: #000000;"> 尽量较少DNS查询的次数。如果你使用了任何”Allow from domain”或”Deny from domain”指令(也就是domain使用的是主机名而不是IP地址)，则代价是要进行两次DNS查询(一次正向和一次反向，以确认没有作假)。所以， 为了得到最高的性能，应该避免使用这些指令(不用域名而用IP地址也是可以的)。</span></li>
<li></li>
<li><span style="color: #000000;">5.为Directory加上FollowSymLinks</span><br />
<span style="color: #000000;"> 如果网站空间中没有使用 Options FollowSymLinks ，Apache就必须执行额外的系统调用以验证符号连接。例如：在请求”/index.html”时，Apache将对”/www”、”/www /htdocs”、”/www/htdocs/index.html”执行lstat()调用。而且lstat()的执行结果不被缓存，因此对每一个请求 都要执行一次。</span></li>
<li></li>
<li><span style="color: #000000;">6.将AllowOverride设置为None</span><br />
<span style="color: #000000;"> 对于使用虚拟主机的朋友可能会觉得不方便，这样设置将会使.htaccess中的设置失效，如果实在需要，并且在有条件的情况下，请在conf配置文件中直接写入rewrite规则</span></li>
<li></li>
<li><span style="color: #000000;">7.禁用内容协商</span><br />
<span style="color: #000000;"> 尽管在实践中，内容协商的好处大于性能的损失，如果你很在意那一点点的性能损失，则可以禁止使用内容协商。但是仍然有个方法可以提高服务器的速度，就是不要使用通配符。</span></li>
<li></li>
<li><span style="color: #000000;">8.MaxRequestsPerChild设置为非0以防止内存泄漏<span id="more-806"></span></span><br />
<span style="color: #000000;"> MaxRequestsPerChild用于控制apache子进程在何时销毁，默认为0，代表永不销毁子进程，这可能会存在内存泄漏的风险，建议设置为10000</span></li>
<li></li>
<li><span style="color: #000000;">9.KeepAlive与KeepAliveTimeOut</span><br />
<span style="color: #000000;"> 如果你使用的使mpm_prefork模式(apache默认安装)，那么建议你将KeepAlive设置为off；因为，开启keepalive会为每 个客户端建立一个连接，prefork不会创建线程，估计100个用户同时访问你的网站，apache就会挂了～，如果你实在想开启，那么请将 KeepAliveTimeOut 时间设置更短些，例如5，默认是60秒呢</span></li>
<li></li>
<li><span style="color: #000000;">10.不要静态编译apache</span><br />
<span style="color: #000000;"> 尽管会有很多人和你说静态编译的好处，同时，你自己也想自己编译一把，以体验乐趣～但是，将模块已静态方式编译进apache绝对不是一个好选择，尤其是对于缺银子的站长们来说，一个配置不当，apache会在启动时就占用光你所有的内存，最后拖垮服务器～</span></li>
</ol>
<p><span style="color: #000000;">转自：http://www.cnphp.info/10-tips-for-optimize-apache-options.html</span></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="如何在PHP网站开发中，指定任意文件扩展名使用PHP解析" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F16.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F806.html">
                        <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/05/04/7493183.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何在PHP网站开发中，指定任意文件扩展名使用PHP解析</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="Apache Rewrite 规则详细解释" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F568.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F806.html">
                        <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;">Apache Rewrite 规则详细解释</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="[技巧] Mysql数据库优化技术—配置篇" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F649.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F806.html">
                        <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;">[技巧] Mysql数据库优化技术—配置篇</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="SVN的服务器端和客户端安装配置 以及与MyEclipse 整合使用" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F244.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F806.html">
                        <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;">SVN的服务器端和客户端安装配置 以及与MyEclipse 整合使用</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="SVN版本库中conf下配置文件详细说明" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F261.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F806.html">
                        <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;">SVN版本库中conf下配置文件详细说明</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><h2  class="related_post_title">【相关文章推荐】</h2><ul class="related_post"><li><a href="http://www.liangkun.net/archives/16.html" title="如何在PHP网站开发中，指定任意文件扩展名使用PHP解析">如何在PHP网站开发中，指定任意文件扩展名使用PHP解析</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.liangkun.net/archives/806.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>新浪SAE如何绑定自定义的域名</title>
		<link>http://www.liangkun.net/archives/790.html</link>
		<comments>http://www.liangkun.net/archives/790.html#comments</comments>
		<pubDate>Sun, 15 Apr 2012 11:06:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[web开发]]></category>
		<category><![CDATA[CNAME的使用，泛域名解析]]></category>
		<category><![CDATA[域名]]></category>

		<guid isPermaLink="false">http://www.liangkun.net/?p=790</guid>
		<description><![CDATA[新浪sae平台(http://sae.sina.com.cn)发展已几年，现在已算比较成熟。现在常可以看到一些用户已将自己的博客架在sae平台来跑，这样一方面省去自己去买服务器的费用，另一方面还可以提高网站的速度。不过sae平台不会像咱们的服务器有那么多的权限给你使用，你没有FTP权限，也不能去登录，像一些比较危险的函数也是被禁用的，像PHP中常用的curl等『不过你可以使用file_get_content来替换curl』，当然这样之所以禁用这些是为了SAE的服务器的安全。 如果你想搭一个网站但是自己没有服务器资源抑或自己的网站访问速度巨慢无比时，你可以尝试将自己的网站转到SAE平台上。特别是上个月SAE发布平台支持绑定自定义的域名。 如果你是运行的是一个商业性的网站，不建议你将网站迁移到SAE平台上去，因为如果SAE平台发生了问题了，你去定位和处理这个问题要花费相对较长的时间，而你的用户可能就因为这个时间太长而慢慢远离你而去。 下面我们主要来说明下如何使用SAE绑定自己的域名： 1. 申请一个SAE账户。 2. 登录后创建一个应用，像wordpress博客，团购等应用可以在“应用仓库”中直接安装。如果用户的应用是自己的开发的，可以将应用按照SAE的规范来安装，详见：http://sae.sina.com.cn/?m=devcenter&#38;catId=230 3. 至此你已安装完自己的应用，可以通过如xxx.sinaapp.com进行访问自己的应用。 4. 这一步我们将实现将个人或公司的域名绑定到xxx.sinaapp.com，实现访问个人或公司的域名就可以看到如同直接访问xxx.sinaapp.com一样的。 1)点击右上解的“我的应用”，选择你刚创建的应用,这里以kohana为例进行说明。 &#160; &#160; &#160; &#160; 2)点击左导上面的“应用管理”下的“应用设置”,在“独立域名设置”下填写自己要绑定的个人或公司的域名。然后会提示将待绑定的域名需要cname到jp.cname.cloudbbs.org。 同时提示你新加一条A记录来验证你拥有这个待绑定域名的管理权。 注意： 一般CNAME绑定后，生效时间很短。而添加后的A记录生效的时间比较长，有时为1天的左右的时间。 如果绑定成功后，会显示绑定成功的。如下图所示： 5.现在你可以通过xxx.sinaapp.com或者你刚才绑定的域名来访问。 值的说明的是：xxx.sinapp.com访问很快（直接国内访问），而通过自定义的域名来访问时相当要慢很多，因为自定义的域名刚才设置的cname值为jp.cname.cloudbbs.org，会去海外去访问jp.cname.cloudbbs.org，然后再在jp.cname.cloudbbs.org中根据用户片定义的域名获取对应的xxx.sinaapp.com，进而实现自定义域名cname到自己的xxx.sinaapp.com，可谓是曲线救国，用心良苦啊. 【相关文章推荐】网站域名生存过程详解<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="网站域名生存过程详解" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F165.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F790.html">
                        <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;">网站域名生存过程详解</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="网易域名邮箱初次使用体验" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F103.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F790.html">
                        <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/05/04/7492938.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">网易域名邮箱初次使用体验</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="为你的网站添加腾讯微博和新浪微博的一键转播功能" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F506.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F790.html">
                        <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/05/04/7492851.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">为你的网站添加腾讯微博和新浪微博的一键转播功能</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="以实例说明域名A记录与泛解析的联系与区别" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F454.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F790.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/22/24156891.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">以实例说明域名A记录与泛解析的联系与区别</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="wordpress博客提高访问速度策略" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F587.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F790.html">
                        <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/05/04/7492487.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">wordpress博客提高访问速度策略</font>
                    </a>
                </td>
        </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>新浪sae平台(http://sae.sina.com.cn)发展已几年，现在已算比较成熟。现在常可以看到一些用户已将自己的博客架在sae平台来跑，这样一方面省去自己去买服务器的费用，另一方面还可以提高网站的速度。不过sae平台不会像咱们的服务器有那么多的权限给你使用，你没有FTP权限，也不能去登录，像一些比较危险的函数也是被禁用的，像PHP中常用的curl等『不过你可以使用file_get_content来替换curl』，当然这样之所以禁用这些是为了SAE的服务器的安全。</p>
<p>如果你想搭一个网站但是自己没有服务器资源抑或自己的网站访问速度巨慢无比时，你可以尝试将自己的网站转到SAE平台上。特别是上个月SAE发布平台支持绑定自定义的域名。<br />
如果你是运行的是一个商业性的网站，不建议你将网站迁移到SAE平台上去，因为如果SAE平台发生了问题了，你去定位和处理这个问题要花费相对较长的时间，而你的用户可能就因为这个时间太长而慢慢远离你而去。</p>
<p><strong>下面我们主要来说明下如何使用SAE绑定自己的域名：</strong><br />
<span style="color: #800000;"><strong>1. 申请一个SAE账户。</strong></span><br />
<span style="color: #800000;"><strong> 2. 登录后创建一个应用，像wordpress博客，团购等应用可以在“应用仓库”中直接安装。如果用户的应用是自己的开发的，可以将应用按照SAE的规范来安装，详见：http://sae.sina.com.cn/?m=devcenter&amp;catId=230</strong></span><br />
<span style="color: #800000;"><strong> 3. 至此你已安装完自己的应用，可以通过如xxx.sinaapp.com进行访问自己的应用。</strong></span><br />
<span style="color: #800000;"><strong> 4. 这一步我们将实现将个人或公司的域名绑定到xxx.sinaapp.com，实现访问个人或公司的域名就可以看到如同直接访问xxx.sinaapp.com一样的。</strong></span><span id="more-790"></span><br />
1)点击右上解的“我的应用”，选择你刚创建的应用,这里以kohana为例进行说明。<br />
<img class="alignleft size-full wp-image-791" title="你刚创建的SAE应用" src="http://www.liangkun.net/wp-content/uploads/2012/04/aa.jpg" alt="你刚创建的SAE应用" /></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>2)点击左导上面的“应用管理”下的“应用设置”,在“独立域名设置”下填写自己要绑定的个人或公司的域名。然后会提示将待绑定的域名需要cname到jp.cname.cloudbbs.org。</p>
<p>同时提示你新加一条A记录来验证你拥有这个待绑定域名的管理权。</p>
<p>注意：</p>
<p>一般CNAME绑定后，生效时间很短。而添加后的A记录生效的时间比较长，有时为1天的左右的时间。</p>
<p>如果绑定成功后，会显示绑定成功的。如下图所示：<strong></strong><br />
<a href="http://www.liangkun.net/wp-content/uploads/2012/04/bb.jpg" target="_blank"><br />
<img class="alignleft size-full wp-image-792" title="自定义域名绑定成功(点击查看原图)" src="http://www.liangkun.net/wp-content/uploads/2012/04/bb.jpg" alt="自定义域名绑定成功" /></a></p>
<p><span style="color: #800000;"><strong> 5.现在你可以通过xxx.sinaapp.com或者你刚才绑定的域名来访问。</strong></span></p>
<p><strong><span style="color: #000000;">值的说明的是：xxx.sinapp.com访问很快（直接国内访问），而通过自定义的域名来访问时相当要慢很多，因为自定义的域名刚才设置的cname值为jp.cname.cloudbbs.org，会去海外去访问jp.cname.cloudbbs.org，然后再在jp.cname.cloudbbs.org中根据用户片定义的域名获取对应的xxx.sinaapp.com，进而实现自定义域名cname到自己的xxx.sinaapp.com，可谓是曲线救国，用心良苦啊.</span></strong></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="网站域名生存过程详解" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F165.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F790.html">
                        <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;">网站域名生存过程详解</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="网易域名邮箱初次使用体验" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F103.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F790.html">
                        <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/05/04/7492938.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">网易域名邮箱初次使用体验</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="为你的网站添加腾讯微博和新浪微博的一键转播功能" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F506.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F790.html">
                        <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/05/04/7492851.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">为你的网站添加腾讯微博和新浪微博的一键转播功能</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="以实例说明域名A记录与泛解析的联系与区别" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F454.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F790.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/22/24156891.png" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">以实例说明域名A记录与泛解析的联系与区别</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="电脑如何一开机后，不用输入登录用户或密码直接进入桌面" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F664.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F790.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/30/15089855.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">电脑如何一开机后，不用输入登录用户或密码直接进入桌面</font>
                    </a>
                </td>
        </tr>
    
    <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><h2  class="related_post_title">【相关文章推荐】</h2><ul class="related_post"><li><a href="http://www.liangkun.net/archives/165.html" title="网站域名生存过程详解">网站域名生存过程详解</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.liangkun.net/archives/790.html/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Nginx源码学习</title>
		<link>http://www.liangkun.net/archives/781.html</link>
		<comments>http://www.liangkun.net/archives/781.html#comments</comments>
		<pubDate>Thu, 05 Apr 2012 09:46:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[web开发]]></category>

		<guid isPermaLink="false">http://www.liangkun.net/?p=781</guid>
		<description><![CDATA[源码包解压之后，根目录下有几个子目录和几个文件，最重要的子目录是auto和src，最重要的文件是configure脚本，不同于绝大多数的开源代码，nginx的configure脚本是作者手工编写的，没有使用autoconf之类的工具去自动生成，configure脚本会引用auto目录下面的脚本文件来干活。根据不同的用途，auto目录下面的脚本各司其职，有检查编译器版本的，有检查操作系统版本的，有检查标准库版本的，有检查模块依赖情况的，有关于安装的，有关于初始化的，有关于多线程检查的等等。configure作为一个总驱动，调用这些脚本去生成版本信息头文件、默认被包含的模块的声明代码和Makefile文件，版本信息头文件(ngx_auto_config.h,ngx_auto_headers.h)和默认被包含的模块的声明代码(ngx_modules.c)被放置在新创建的objs目录下。要注意的是，这几个生成的文件和src下面的源代码一样重要，对于理解源码是不可忽略的重要部分。 src是源码存放的目录，configure创建的objs/src目录是用来存放生成的.o文件的，注意区分一下。 src按照功能特性划分为几个部分，对应着是几个不同的子目录。 src/core存放着主干部分、基础数据结构和基础设施的源码，main函数在src/core/nginx.c中，这是分析源码的一个很好的起点。core module的源码 也是Nginx服务的入口 src/event存放着事件驱动模型和相关模块的源码。对自身事件逻辑的封装。 src/http存放着http server和相关模块的源码。nginx作为web/http server运行时的核心模块。 src/mail存放着邮件代理和相关模块的源码。nginx作为imap/pop3/smtp proxy server运行的核心模块。 src/misc存放着C＋＋兼容性测试和google perftools模块的源码。一些utils 定义一些test和profiler的一些外围模块的逻辑。 src/os存放着依赖于操作系统实现的源码，nginx启动过程中最重要的master和workers创建代码就在这个目录下，多少让人觉得有点意外。对各个平台抽象逻辑的封装。 nginx的实现中有非常多的结构体，一般命名为ngx_XXX_t，这些结构体分散在许多头文件中，而在src/core/ngx_core.h中把几乎所有的头文件都集合起来，所有的实现文件都会包含这个ngx_core.h头文件，说nginx的各部分源码耦合厉害就是这个原因，但实际上nginx各个部分之间逻辑上是划分的很清晰的，整体上是一种松散的结构。nginx实现了一些精巧的基础数据结构，例如ngx_string_t,ngx_list_t,ngx_array_t,ngx_pool_t,ngx_buf_t,ngx_queue_t,ngx_rbtree_t,ngx_radix_tree_t等等，还有一些重要的基础设施，比如log,configure file,time等等，这些数据结构和基础设施频繁的被使用在许多地方，这会让人感觉nginx逻辑上的联系比较紧密，但熟悉了这些基础数据结构的实现代码就会感觉到这些数据结构都是清晰分明的，并没有真正的耦合在一起，只是有些多而已，不过nginx中“家酿”的代码也正是它的一个很明显的亮点。 nginx是高度模块化的，可以根据自己的需要定制模块，也可以自己根据一定的标准开发需要的模块，已经定制的模块会在objs/ngx_modules.c中声明，这个文件是由configure生成的。 nginx启动过程中，很重要的一步就是加载和初始化模块，这是在ngx_init_cycle中完成的，ngx_init_cycle会调用模块的hook接口（init_module）对模块初始化，ngx_init_cycle还会调用ngx_open_listening_sockets初始化socket，如果是多进程方式启动，就会调用ngx_master_process_cycle完成最后的启动动作，ngx_master_process_cycle调用ngx_start_worker_processes生成多个工作子进程，ngx_start_worker_processes调用ngx_worker_process_cycle创建工作内容，如果进程有多个子线程，这里也会初始化线程和创建线程工作内容，初始化完成之后，ngx_worker_process_cycle会进入处理循环，调用ngx_process_events_and_timers，该函数调用ngx_process_events监听事件，并把事件投递到事件队列ngx_posted_events中，最终会在ngx_event_thread_process_posted中处理事件。 事件机制是nginx中很关键的一个部分，linux下使用了epool，freebsd下使用了kqueue管理事件。 最后附上Joshua友情提供的源码大图一张，感谢：） 随机推荐文章WordPress模板入门学习篇Firefox 查看、修改cookie插件—Firecookiewordpress博客提高访问速度策略linux下的crontab 使用说明及案例妙用hosts文件QQ空间查看好友发表日志所用技术什么是UE、UI、UCD、UED？UE、UI、UCD、UED四者的区别 php中全等(===)和相等(==)的用法区别使用百度统计如何设置直接输入密码就可以查看网站相关的数据情况如何正确填写备案信息<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="学习如何利用photoshop制作简单logo图标" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F338.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F781.html">
                        <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/05/04/7492893.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;">学习如何利用photoshop制作简单logo图标</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress模板入门学习篇" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F57.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F781.html">
                        <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;">WordPress模板入门学习篇</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="汽车驾驶证划分基本知识学习" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F497.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F781.html">
                        <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/05/04/7492853.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;">汽车驾驶证划分基本知识学习</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="架构学习:四层和七层负载均衡的区别" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F776.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F781.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/12/27/13134880.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;">架构学习:四层和七层负载均衡的区别</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="VI常用实用命令学习" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F220.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F781.html">
                        <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;">VI常用实用命令学习</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>源码包解压之后，根目录下有几个子目录和几个文件，最重要的子目录是auto和src，最重要的文件是configure脚本，不同于绝大多数的开源代码，nginx的configure脚本是作者手工编写的，没有使用autoconf之类的工具去自动生成，configure脚本会引用auto目录下面的脚本文件来干活。根据不同的用途，auto目录下面的脚本各司其职，有检查编译器版本的，有检查操作系统版本的，有检查标准库版本的，有检查模块依赖情况的，有关于安装的，有关于初始化的，有关于多线程检查的等等。configure作为一个总驱动，调用这些脚本去生成版本信息头文件、默认被包含的模块的声明代码和Makefile文件，版本信息头文件(ngx_auto_config.h,ngx_auto_headers.h)和默认被包含的模块的声明代码(ngx_modules.c)被放置在新创建的objs目录下。要注意的是，这几个生成的文件和src下面的源代码一样重要，对于理解源码是不可忽略的重要部分。</p>
<p>src是源码存放的目录，configure创建的objs/src目录是用来存放生成的.o文件的，注意区分一下。</p>
<p>src按照功能特性划分为几个部分，对应着是几个不同的子目录。</p>
<p>src/core存放着主干部分、基础数据结构和基础设施的源码，main函数在src/core/nginx.c中，这是分析源码的一个很好的起点。core module的源码 也是Nginx服务的入口</p>
<p>src/event存放着事件驱动模型和相关模块的源码。对自身事件逻辑的封装。</p>
<p>src/http存放着http server和相关模块的源码。nginx作为web/http server运行时的核心模块。</p>
<p>src/mail存放着邮件代理和相关模块的源码。nginx作为imap/pop3/smtp proxy server运行的核心模块。</p>
<p>src/misc存放着C＋＋兼容性测试和google perftools模块的源码。一些utils 定义一些test和profiler的一些外围模块的逻辑。</p>
<p>src/os存放着依赖于操作系统实现的源码，nginx启动过程中最重要的master和workers创建代码就在这个目录下，多少让人觉得有点意外。对各个平台抽象逻辑的封装。<span id="more-781"></span></p>
<div>nginx的实现中有非常多的结构体，一般命名为ngx_XXX_t，这些结构体分散在许多头文件中，而在src/core/ngx_core.h中把几乎所有的头文件都集合起来，所有的实现文件都会包含这个ngx_core.h头文件，说nginx的各部分源码耦合厉害就是这个原因，但实际上nginx各个部分之间逻辑上是划分的很清晰的，整体上是一种松散的结构。nginx实现了一些精巧的基础数据结构，例如ngx_string_t,ngx_list_t,ngx_array_t,ngx_pool_t,ngx_buf_t,ngx_queue_t,ngx_rbtree_t,ngx_radix_tree_t等等，还有一些重要的基础设施，比如log,configure file,time等等，这些数据结构和基础设施频繁的被使用在许多地方，这会让人感觉nginx逻辑上的联系比较紧密，但熟悉了这些基础数据结构的实现代码就会感觉到这些数据结构都是清晰分明的，并没有真正的耦合在一起，只是有些多而已，不过nginx中“家酿”的代码也正是它的一个很明显的亮点。</p>
<p>nginx是高度模块化的，可以根据自己的需要定制模块，也可以自己根据一定的标准开发需要的模块，已经定制的模块会在objs/ngx_modules.c中声明，这个文件是由configure生成的。</p>
<p>nginx启动过程中，很重要的一步就是加载和初始化模块，这是在ngx_init_cycle中完成的，ngx_init_cycle会调用模块的hook接口（init_module）对模块初始化，ngx_init_cycle还会调用ngx_open_listening_sockets初始化socket，如果是多进程方式启动，就会调用ngx_master_process_cycle完成最后的启动动作，ngx_master_process_cycle调用ngx_start_worker_processes生成多个工作子进程，ngx_start_worker_processes调用ngx_worker_process_cycle创建工作内容，如果进程有多个子线程，这里也会初始化线程和创建线程工作内容，初始化完成之后，ngx_worker_process_cycle会进入处理循环，调用ngx_process_events_and_timers，该函数调用ngx_process_events监听事件，并把事件投递到事件队列ngx_posted_events中，最终会在ngx_event_thread_process_posted中处理事件。</p>
<p>事件机制是nginx中很关键的一个部分，linux下使用了epool，freebsd下使用了kqueue管理事件。</p>
<p>最后附上Joshua友情提供的源码大图一张，感谢：）</p></div>
<div><a target="_blank" href="http://p.blog.csdn.net/images/p_blog_csdn_net/kenbinzhang/EntryImages/20091011/14.jpg"><img alt="kenbin" src="http://p.blog.csdn.net/images/p_blog_csdn_net/kenbinzhang/EntryImages/20091011/14.jpg" width="675" height="1500"></a></div>
<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="学习如何利用photoshop制作简单logo图标" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F338.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F781.html">
                        <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/05/04/7492893.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;">学习如何利用photoshop制作简单logo图标</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress模板入门学习篇" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F57.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F781.html">
                        <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;">WordPress模板入门学习篇</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="汽车驾驶证划分基本知识学习" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F497.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F781.html">
                        <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/05/04/7492853.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;">汽车驾驶证划分基本知识学习</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="架构学习:四层和七层负载均衡的区别" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F776.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F781.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/12/27/13134880.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;">架构学习:四层和七层负载均衡的区别</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="VI常用实用命令学习" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F220.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F781.html">
                        <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;">VI常用实用命令学习</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><h2  class="related_post_title">随机推荐文章</h2><ul class="related_post"><li><a href="http://www.liangkun.net/archives/506.html" title="为你的网站添加腾讯微博和新浪微博的一键转播功能">为你的网站添加腾讯微博和新浪微博的一键转播功能</a></li><li><a href="http://www.liangkun.net/archives/607.html" title="在wordpress中给图片添加水印设置">在wordpress中给图片添加水印设置</a></li><li><a href="http://www.liangkun.net/archives/738.html" title="WordPress高亮代码插件WP-CodeBox">WordPress高亮代码插件WP-CodeBox</a></li><li><a href="http://www.liangkun.net/archives/234.html" title="vim和vi的区别">vim和vi的区别</a></li><li><a href="http://www.liangkun.net/archives/664.html" title="电脑如何一开机后，不用输入登录用户或密码直接进入桌面">电脑如何一开机后，不用输入登录用户或密码直接进入桌面</a></li><li><a href="http://www.liangkun.net/archives/557.html" title="十个PHP高级应用技巧">十个PHP高级应用技巧</a></li><li><a href="http://www.liangkun.net/archives/687.html" title="在zend studio集成Aptana">在zend studio集成Aptana</a></li><li><a href="http://www.liangkun.net/archives/464.html" title="英文网站如何一步步获取流量">英文网站如何一步步获取流量</a></li><li><a href="http://www.liangkun.net/archives/338.html" title="学习如何利用photoshop制作简单logo图标">学习如何利用photoshop制作简单logo图标</a></li><li><a href="http://www.liangkun.net/archives/277.html" title="如何安装Zend Optimizer及确认Zend Optimizer是否已装上">如何安装Zend Optimizer及确认Zend Optimizer是否已装上</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.liangkun.net/archives/781.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>开发人员成长中的问题</title>
		<link>http://www.liangkun.net/archives/776.html</link>
		<comments>http://www.liangkun.net/archives/776.html#comments</comments>
		<pubDate>Sun, 01 Apr 2012 00:11:29 +0000</pubDate>
		<dc:creator>liangkun</dc:creator>
				<category><![CDATA[梁言坤语]]></category>

		<guid isPermaLink="false">http://www.liangkun.net/?p=776</guid>
		<description><![CDATA[回想从最初开始负责丁香园技术团队到现在，团队规模已经增加了几倍，有人离职，也有更多的人加入。团队一大，自然有些问题会浮现出来。比如最近在和团队同事聊天或是面试面谈的时候，经常会听到类似的话「觉得现在的工作没什么挑战」或是「感觉学不到东西」，以前偶尔听到团队同事这样的反馈，还是挺让我着急的，我第一直觉是很惭愧，公司或是团队给同事提供的资源和机会太少了，于是，不停的争取资源或是尽量改进，但是最后我逐渐发现，这样还是不能完全解决问题，这并非是问题的根源，因为一方面有人说没挑战 ，一方面是一堆老大难问题很久得不到解决。觉得「没挑战」和「没成长」其实是很多人会有的心态，尤其是刚参加工作没几年的容易形成这样习惯上的认知。 我以前写过一篇 工程师在创业团队的技术挑战 ，说了一下我对技术上的「挑战」的看法，现在趁着有点空闲，再谈谈谈创业团队中的成员的「挑战」以及「成长」的问题。{请注意，这只是一篇随笔，我无意去讨论什么管理之类的废话，也不奢望就这么几个字能解决所有问题，对少数人起到一个提醒的作用就足够了} 一般觉得工作没什么挑战的，原因可能无外乎几个: 要么认为自己的能力足够高了，不屑于再做「简单」的事情； 要么认为自己是在做「重复」的工作；要么，觉得没接触到新东西；也很有可能只是各种借口或是「心态」的体现。 实际上，任何团队中都没有「简单」的事情，只有做得好或是做不好的事情。什么是简单? 给产品写一段文字说明够简单么？写一封 EDM 够简单么? 如果仔细推敲的话，会看到绝大多数文案都是糟糕的一塌糊涂，那么为什么不用更高的标准要求以下自己呢？既然能力够高了，为什么你说的「简单」的事情还做不好呢？所谓眼高手低，不就是说这种情况么? 如果小事情做到比别人好，那么大一点的事情团队就会更加放心的给你去做。否则的话，换了是你，你也不会将重要的任务交给连小事情都做不好的人吧? 任何团队中也没有「重复」的事情。任何事情，如果不针对反馈做任何改进的话，做第二遍你就会觉得是重复；而如果每次都能根据反馈不停的修正，那么做成千上万次可能还会找到乐趣。比如说我们网站经常要给用户设计一些广告图片，有的同事说，总让我做广告图片，枯燥、乏味，我的设计能力如何得到提高? 的确，如果每次都用最低的标准要求自己，怎么提高呢？客户或是同事给你的反馈，比如，图片上的文字都是毛边的，无论怎么说你都无动于衷，那么怎么可能真的提高呢? 所以，面对「重复」的事情，必须不断的给自己设立新标准，然后努力去突破，重复的事情里面依然大有文章，想想如何提高质量，再想想如何提升效率。 至于说接触不到新技术，其实问一句话就好: 你业余时间为什么不学呢? 大部分回答是: 没时间。这是无解的问题。一般听到「没时间」，有时间整天逛淘宝难道没时间学习么? 其实潜台词都是「这是不重要的事情」，任何事情，你不投入比别人更多的精力，怎么做到比别人更好么？ 正所谓，「以大多数人的努力程度之低，根本轮不到去拼天赋」，同样，不做好准备，也等不来机会。 至于心态，我引用丁香园 CEO 张进的一句话：两个都是新入职的同事，也都是第一份工作，交给他们差不多的事情做，一个想「他奶奶的，就这么点工资，让干这么多活?」，另一个则想「没想到新人都给这么多机会锻炼」，你说过几年谁的成就更大? 这或许可以回答某些人的疑问「为什么我和同学毕业的时候都差不多，怎么过几年不见，人家都做到某公司总监乃至副总了，我还是在不停的换工作?」，就是心态导致的差异。 有些人觉得创业团队或是小型公司里面，资源少，「学不到什么东西」，其实，是你没仔细去学习应该学的东西。前几天给几个好友的新创业项目提建议，我说你们某个地方做的不及格，他们说要我给讲讲，我说这个应该不用讲的，你们团队中的某某，以前看过我做同样的事情，按理说，他也能做一下的。遗憾的是，没去做，也做不来。为什么? 别人做他熟悉的那一点领域之外的事情，他是漠不关心的，意识不到学习更多东西是有价值的。有人说，问题就是机会，团队的问题，就是每个人的机会，谁能解决掉，就会给团队带来更大的价值，相应的，他也会得到更大的回报。而在创业团队里面，恰恰是需要解决问题的人，不欢迎那些不动脑筋的螺丝钉。创业团队中，可接触的问题不可谓不多，公司的方方面面都需要有人动手来做，如果平时多用点心思，学到的东西早晚在将来还会用到。很多人不都是有创业的想法么？但是你连基本的积累都不够，创业? 怕是要撞墙。 那么是不是在大公司里面才能让人得到锻炼呢? 曾经遇到过不少工程师当面告诉我，想去某某大型互联网公司去工作几年，提高一下技术，遗憾的是，几乎没看到一个人在几年后能力真的得到提升，有的甚至退步，为什么？一个很大的原因是，大公司里面多数的事情都已经固定下来了，而很多牛人之所以牛，是因为他们遇到公司从小到大的过程，在这个过程中他们得到了难得的成长机遇，不停的学习充实自己，解决各种问题，才成为牛人，牛人也多是苦日子熬过来的。等到天下皆定，哪还有那么多硬仗好打呢? 另外，「想锻炼技术」并不是一个很好的出发点，单纯的想锻炼技术实际上并不利于「解决问题」，培养能力和意识更为关键。 我在微博上调侃过：很多人都希望找到一个完美的公司，比如，办公室要无比舒适；用最好的设备；完备的培训机制，还别占用休息时间；弹性工作制；别他妈太累；也别让老子加班；公司前台要好看；没有刻板的工作流程；工作要有创造性不是重复劳动，别管我是否有创造性;队友不是猪而且都是天才，遇到困难他们就会出手解决；做的事必须是最潮的，但别管赚钱与否&#8230; 还有，最重要的，薪水要高。遗憾的是，这样的工作估计是做公务员也不一定完全具备，只会让自己更加痛苦，甚至增加无谓的抱怨。 提起抱怨来，也有必要说一下对队友的抱怨这个事情。曾经见过有人对一起合作项目同事的抱怨，比如设计师抱怨合作的产品经理有问题，总要不停的修改，时间长了，认为产品团队都很烂，经常打扰你，那么有没有想过，你是否可以给产品设计提出更好的建议呢? 甚至，有些产品设计你是否可以进行改进呢? 什么?「那不是我的工作!」 可是，为什么要给自己的能力设定一个边界? 这是多么可悲的事情，你完全可以无限制的突破边界，突破个人的局限。或许再过几年你会成为一个更好的产品设计师的啊。Zynga 的核心价值观有一条是「Level up」，不断升级，这恰恰是我们普遍缺少的心态。 的确，这是个浮躁的时代。大家容易听到各种各样的声音，每当心存困惑的时候不妨静下心来，加强对自身的认知。别幻想着走捷径，也尽量少去问别人如何成功，那些没有用，只要你别总在错误的路上越绕越远，将一些看似细微的事情做到更好，最后的成就依然惊人。 看清无处不在的「挑战」，让自己真正有所「成长」，毕竟，以后每个人都要承担更多的责任，只要你愿意。 &#8211;EOF&#8211; 原文来自于：http://www.dbanotes.net/startup/Challenge_and_Grow_up.html 随机推荐文章金山张宴谈架构Linux性能分析工具(vmstat,iostat,sar)Session与cookie 原理及使用小结 (2)平面设计视觉要素个人心得SVN的服务器端和客户端安装配置 以及与MyEclipse 整合使用大型网站架构必须要面对的问题在zend studio集成Aptana卓越网CEO的幸福生活浅谈数据库系统中的cache距高梁生日还有三天时间了，呼呼~万岁万万岁<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="金山张宴谈架构" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F457.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F776.html">
                        <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/05/06/7725723.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">金山张宴谈架构</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="百万级PHP网站架构" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F473.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F776.html">
                        <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;">百万级PHP网站架构</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="大型网站架构心得体会" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F4.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F776.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/03/27590691.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">大型网站架构心得体会</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="大型网站架构必须要面对的问题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F204.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F776.html">
                        <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;">大型网站架构必须要面对的问题</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="运维工作人员的大型网站探讨和心得" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F176.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F776.html">
                        <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;">运维工作人员的大型网站探讨和心得</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>回想从最初开始负责丁香园技术团队到现在，团队规模已经增加了几倍，有人离职，也有更多的人加入。团队一大，自然有些问题会浮现出来。比如最近在和团队同事聊天或是面试面谈的时候，经常会听到类似的话「觉得现在的工作没什么挑战」或是「感觉学不到东西」，以前偶尔听到团队同事这样的反馈，还是挺让我着急的，我第一直觉是很惭愧，公司或是团队给同事提供的资源和机会太少了，于是，不停的争取资源或是尽量改进，但是最后我逐渐发现，这样还是不能完全解决问题，这并非是问题的根源，因为一方面有人说没挑战 ，一方面是一堆老大难问题很久得不到解决。觉得「没挑战」和「没成长」其实是很多人会有的心态，尤其是刚参加工作没几年的容易形成这样习惯上的认知。<br />
我以前写过一篇 工程师在创业团队的技术挑战 ，说了一下我对技术上的「挑战」的看法，现在趁着有点空闲，再谈谈谈创业团队中的成员的「挑战」以及「成长」的问题。{请注意，这只是一篇随笔，我无意去讨论什么管理之类的废话，也不奢望就这么几个字能解决所有问题，对少数人起到一个提醒的作用就足够了}<br />
一般觉得工作没什么挑战的，原因可能无外乎几个: 要么认为自己的能力足够高了，不屑于再做「简单」的事情； 要么认为自己是在做「重复」的工作；要么，觉得没接触到新东西；也很有可能只是各种借口或是「心态」的体现。<br />
实际上，任何团队中都没有「简单」的事情，只有做得好或是做不好的事情。什么是简单? 给产品写一段文字说明够简单么？写一封 EDM 够简单么? 如果仔细推敲的话，会看到绝大多数文案都是糟糕的一塌糊涂，那么为什么不用更高的标准要求以下自己呢？既然能力够高了，为什么你说的「简单」的事情还做不好呢？所谓眼高手低，不就是说这种情况么? 如果小事情做到比别人好，那么大一点的事情团队就会更加放心的给你去做。否则的话，换了是你，你也不会将重要的任务交给连小事情都做不好的人吧?<span id="more-776"></span><br />
任何团队中也没有「重复」的事情。任何事情，如果不针对反馈做任何改进的话，做第二遍你就会觉得是重复；而如果每次都能根据反馈不停的修正，那么做成千上万次可能还会找到乐趣。比如说我们网站经常要给用户设计一些广告图片，有的同事说，总让我做广告图片，枯燥、乏味，我的设计能力如何得到提高? 的确，如果每次都用最低的标准要求自己，怎么提高呢？客户或是同事给你的反馈，比如，图片上的文字都是毛边的，无论怎么说你都无动于衷，那么怎么可能真的提高呢? 所以，面对「重复」的事情，必须不断的给自己设立新标准，然后努力去突破，重复的事情里面依然大有文章，想想如何提高质量，再想想如何提升效率。<br />
至于说接触不到新技术，其实问一句话就好: 你业余时间为什么不学呢? 大部分回答是: 没时间。这是无解的问题。一般听到「没时间」，有时间整天逛淘宝难道没时间学习么? 其实潜台词都是「这是不重要的事情」，任何事情，你不投入比别人更多的精力，怎么做到比别人更好么？ 正所谓，「以大多数人的努力程度之低，根本轮不到去拼天赋」，同样，不做好准备，也等不来机会。<br />
至于心态，我引用丁香园 CEO 张进的一句话：两个都是新入职的同事，也都是第一份工作，交给他们差不多的事情做，一个想「他奶奶的，就这么点工资，让干这么多活?」，另一个则想「没想到新人都给这么多机会锻炼」，你说过几年谁的成就更大? 这或许可以回答某些人的疑问「为什么我和同学毕业的时候都差不多，怎么过几年不见，人家都做到某公司总监乃至副总了，我还是在不停的换工作?」，就是心态导致的差异。<br />
有些人觉得创业团队或是小型公司里面，资源少，「学不到什么东西」，其实，是你没仔细去学习应该学的东西。前几天给几个好友的新创业项目提建议，我说你们某个地方做的不及格，他们说要我给讲讲，我说这个应该不用讲的，你们团队中的某某，以前看过我做同样的事情，按理说，他也能做一下的。遗憾的是，没去做，也做不来。为什么? 别人做他熟悉的那一点领域之外的事情，他是漠不关心的，意识不到学习更多东西是有价值的。有人说，问题就是机会，团队的问题，就是每个人的机会，谁能解决掉，就会给团队带来更大的价值，相应的，他也会得到更大的回报。而在创业团队里面，恰恰是需要解决问题的人，不欢迎那些不动脑筋的螺丝钉。创业团队中，可接触的问题不可谓不多，公司的方方面面都需要有人动手来做，如果平时多用点心思，学到的东西早晚在将来还会用到。很多人不都是有创业的想法么？但是你连基本的积累都不够，创业? 怕是要撞墙。<br />
那么是不是在大公司里面才能让人得到锻炼呢? 曾经遇到过不少工程师当面告诉我，想去某某大型互联网公司去工作几年，提高一下技术，遗憾的是，几乎没看到一个人在几年后能力真的得到提升，有的甚至退步，为什么？一个很大的原因是，大公司里面多数的事情都已经固定下来了，而很多牛人之所以牛，是因为他们遇到公司从小到大的过程，在这个过程中他们得到了难得的成长机遇，不停的学习充实自己，解决各种问题，才成为牛人，牛人也多是苦日子熬过来的。等到天下皆定，哪还有那么多硬仗好打呢? 另外，「想锻炼技术」并不是一个很好的出发点，单纯的想锻炼技术实际上并不利于「解决问题」，培养能力和意识更为关键。<br />
我在微博上调侃过：很多人都希望找到一个完美的公司，比如，办公室要无比舒适；用最好的设备；完备的培训机制，还别占用休息时间；弹性工作制；别他妈太累；也别让老子加班；公司前台要好看；没有刻板的工作流程；工作要有创造性不是重复劳动，别管我是否有创造性;队友不是猪而且都是天才，遇到困难他们就会出手解决；做的事必须是最潮的，但别管赚钱与否&#8230; 还有，最重要的，薪水要高。遗憾的是，这样的工作估计是做公务员也不一定完全具备，只会让自己更加痛苦，甚至增加无谓的抱怨。<br />
提起抱怨来，也有必要说一下对队友的抱怨这个事情。曾经见过有人对一起合作项目同事的抱怨，比如设计师抱怨合作的产品经理有问题，总要不停的修改，时间长了，认为产品团队都很烂，经常打扰你，那么有没有想过，你是否可以给产品设计提出更好的建议呢? 甚至，有些产品设计你是否可以进行改进呢? 什么?「那不是我的工作!」 可是，为什么要给自己的能力设定一个边界? 这是多么可悲的事情，你完全可以无限制的突破边界，突破个人的局限。或许再过几年你会成为一个更好的产品设计师的啊。Zynga 的核心价值观有一条是「Level up」，不断升级，这恰恰是我们普遍缺少的心态。<br />
的确，这是个浮躁的时代。大家容易听到各种各样的声音，每当心存困惑的时候不妨静下心来，加强对自身的认知。别幻想着走捷径，也尽量少去问别人如何成功，那些没有用，只要你别总在错误的路上越绕越远，将一些看似细微的事情做到更好，最后的成就依然惊人。<br />
看清无处不在的「挑战」，让自己真正有所「成长」，毕竟，以后每个人都要承担更多的责任，只要你愿意。<br />
&#8211;EOF&#8211;</p>
<p>原文来自于：<a href="http://www.dbanotes.net/startup/Challenge_and_Grow_up.html">http://www.dbanotes.net/startup/Challenge_and_Grow_up.html</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="金山张宴谈架构" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F457.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F776.html">
                        <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/05/06/7725723.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">金山张宴谈架构</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="百万级PHP网站架构" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F473.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F776.html">
                        <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;">百万级PHP网站架构</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="大型网站架构心得体会" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F4.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F776.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/03/27590691.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">大型网站架构心得体会</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="大型网站架构必须要面对的问题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F204.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F776.html">
                        <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;">大型网站架构必须要面对的问题</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="运维工作人员的大型网站探讨和心得" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F176.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F776.html">
                        <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;">运维工作人员的大型网站探讨和心得</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><h2  class="related_post_title">随机推荐文章</h2><ul class="related_post"><li><a href="http://www.liangkun.net/archives/738.html" title="WordPress高亮代码插件WP-CodeBox">WordPress高亮代码插件WP-CodeBox</a></li><li><a href="http://www.liangkun.net/archives/400.html" title="使用百度统计如何设置直接输入密码就可以查看网站相关的数据情况">使用百度统计如何设置直接输入密码就可以查看网站相关的数据情况</a></li><li><a href="http://www.liangkun.net/archives/653.html" title="[技巧] 生产环境下的MySQL数据库备份和恢复">[技巧] 生产环境下的MySQL数据库备份和恢复</a></li><li><a href="http://www.liangkun.net/archives/215.html" title="解析mysql 数据库的主从同步原理">解析mysql 数据库的主从同步原理</a></li><li><a href="http://www.liangkun.net/archives/624.html" title="wordpress中为文章加上访问密码">wordpress中为文章加上访问密码</a></li><li><a href="http://www.liangkun.net/archives/22.html" title="距高梁生日还有三天时间了，呼呼~万岁万万岁">距高梁生日还有三天时间了，呼呼~万岁万万岁</a></li><li><a href="http://www.liangkun.net/archives/232.html" title="linux下的rz及sz的安装及使用说明">linux下的rz及sz的安装及使用说明</a></li><li><a href="http://www.liangkun.net/archives/473.html" title="百万级PHP网站架构">百万级PHP网站架构</a></li><li><a href="http://www.liangkun.net/archives/480.html" title="十位顶级PHP开发工程师的开发原则">十位顶级PHP开发工程师的开发原则</a></li><li><a href="http://www.liangkun.net/archives/578.html" title="CHINAZ创始人阿飞谈站长与创业者">CHINAZ创始人阿飞谈站长与创业者</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.liangkun.net/archives/776.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PHP的垃圾回收机制</title>
		<link>http://www.liangkun.net/archives/769.html</link>
		<comments>http://www.liangkun.net/archives/769.html#comments</comments>
		<pubDate>Fri, 30 Mar 2012 06:54:38 +0000</pubDate>
		<dc:creator>zhang</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP内核]]></category>

		<guid isPermaLink="false">http://www.liangkun.net/?p=769</guid>
		<description><![CDATA[每一种计算机语言都有自己的自动垃圾回收机制，让程序员不必过分关心程序内存分配，php也不例外,但是在面向对象编程(OOP)编程中，有些对象需要显式的销毁；防止程序执行内存溢出。 一、PHP 垃圾回收机制(Garbage Collector 简称GC) 在PHP中，没有任何变量指向这个对象时，这个对象就成为垃圾。PHP会将其在内存中销毁；这是PHP的GC垃圾处理机制，防止内存溢出。 当一个PHP线程结束时，当前占用的所有内存空间都会被销毁，当前程序中所有对象同时被销毁。GC进程一般都跟着每起一个SESSION而开始运行的.gc目的是为了在session文件过期以后自动销毁删除这些文件. 二、__destruct /unset __destruct() 析构函数，是在垃圾对象被回收时执行。 unset 销毁的是指向对象的变量，而不是这个对象。 三、 Session 与 GC 由于PHP的工作机制，它并没有一个daemon线程来定期的扫描Session信息并判断其是否失效，当一个有效的请求发生时，PHP 会根据全局变量 session.gc_probability和session.gc_divisor的值，来决定是否启用一个GC, 在默认情况下，session.gc_probability=1, session.gc_divisor =100也就是说有1%的可能性启动GC(也就是说100个请求中只有一个gc会伴随100个中的某个请求而启动). GC的工作就是扫描所有的Session信息，用当前时间减去session最后修改的时间，同session.gc_maxlifetime参数进行比较，如果生存时间超过gc_maxlifetime(默认24分钟),就将该session删除。 但是，如果你Web服务器有多个站点，多个站点时,GC处理session可能会出现意想不到的结果，原因就是：GC在工作时，并不会区分不同站点的session. 那么这个时候怎么解决呢？ 1. 修改session.save_path,或使用session_save_path()让每个站点的session保存到一个专用目录， 2. 提供GC的启动率，自然，GC的启动率提高，系统的性能也会相应减低，不推荐。 3. 在代码中判断当前session的生存时间，利用session_destroy()删除. 看下面的例子 Example 1: gc.php &#60;?php error_reporting(E_ALL); $a = &#8216;I am test.&#8217;; $b = &#38; $a; echo $b .”\n”; ?&#62; 不用说 % php -f [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="PHP框架自动加载类的实现" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F749.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F769.html">
                        <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;">PHP框架自动加载类的实现</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="php中全等(===)和相等(==)的用法区别" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F722.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F769.html">
                        <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;">php中全等(===)和相等(==)的用法区别</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="收藏PHP常用函数" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2F%3Fp%3D736&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F769.html">
                        <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;">收藏PHP常用函数</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="十个PHP高级应用技巧" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F557.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F769.html">
                        <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;">十个PHP高级应用技巧</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP 扩展总结" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F643.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F769.html">
                        <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;">PHP 扩展总结</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[<div>
<div>
<p>每一种计算机语言都有自己的自动垃圾回收机制，让程序员不必过分关心程序内存分配，php也不例外,但是在面向对象编程(OOP)编程中，有些对象需要显式的销毁；防止程序执行内存溢出。</p>
<p><img class="alignleft size-full wp-image-770" title="php" src="http://www.liangkun.net/wp-content/uploads/2012/03/php.jpg" alt="" /><br />
一、PHP 垃圾回收机制(Garbage Collector 简称GC)<br />
在PHP中，没有任何变量指向这个对象时，这个对象就成为垃圾。PHP会将其在内存中销毁；这是PHP的GC垃圾处理机制，防止内存溢出。<br />
当一个PHP线程结束时，当前占用的所有内存空间都会被销毁，当前程序中所有对象同时被销毁。GC进程一般都跟着每起一个SESSION而开始运行的.gc目的是为了在session文件过期以后自动销毁删除这些文件.</p>
<p>二、__destruct /unset<br />
__destruct() 析构函数，是在垃圾对象被回收时执行。<br />
unset 销毁的是指向对象的变量，而不是这个对象。</p>
<p>三、 Session 与 GC<br />
由于PHP的工作机制，它并没有一个daemon线程来定期的扫描Session信息并判断其是否失效，当一个有效的请求发生时，PHP 会根据全局变量 session.gc_probability和session.gc_divisor的值，来决定是否启用一个GC, 在默认情况下，session.gc_probability=1, session.gc_divisor =100也就是说有1%的可能性启动GC(也就是说100个请求中只有一个gc会伴随100个中的某个请求而启动).<br />
GC的工作就是扫描所有的Session信息，用当前时间减去session最后修改的时间，同session.gc_maxlifetime参数进行比较，如果生存时间超过gc_maxlifetime(默认24分钟),就将该session删除。<br />
但是，如果你Web服务器有多个站点，多个站点时,GC处理session可能会出现意想不到的结果，原因就是：GC在工作时，并不会区分不同站点的session.</p>
<p>那么这个时候怎么解决呢？<br />
1. 修改session.save_path,或使用session_save_path()让每个站点的session保存到一个专用目录，<br />
2. 提供GC的启动率，自然，GC的启动率提高，系统的性能也会相应减低，不推荐。<br />
3. 在代码中判断当前session的生存时间，利用session_destroy()删除.<span id="more-769"></span></p>
<p>看下面的例子</p>
<p>Example 1: gc.php<br />
&lt;?php<br />
error_reporting(E_ALL);<br />
$a = &#8216;I am test.&#8217;;<br />
$b = &amp; $a;</p>
<p>echo $b .”\n”;<br />
?&gt;</p>
<p>不用说 % php -f gc.php 输出结果非常明了:<br />
<em>hy0kl% php -f gc.php<br />
I am test.</em></p>
<p>好,下一个:<br />
Example 2:<br />
&lt;?php<br />
error_reporting(E_ALL);<br />
$a = &#8216;I am test.&#8217;;<br />
$b = &amp; $a;</p>
<p>$b = &#8216;I will change?&#8217;;</p>
<p>echo $a .”\n”;<br />
echo $b .”\n”;<br />
?&gt;<br />
执行结果依然很明显:<br />
<em>hy0kl% php -f gc.php<br />
I will change?<br />
I will change?</em></p>
<p>君请看:<br />
Example 3:<br />
&lt;?php<br />
error_reporting(E_ALL);<br />
$a = &#8216;I am test.&#8217;;<br />
$b = &amp; $a;</p>
<p>unset($a);</p>
<p>echo $a .”\n”;<br />
echo $b .”\n”;<br />
?&gt;<br />
是不是得想一下下呢?<br />
<em>hy0kl% php -f gc.php<br />
Notice: Undefined variable: a in /usr/local/www/apache22/data/test/gc.php on line 8<br />
I am test.<br />
</em>有点犯迷糊了吗?</p>
<p>君再看:<br />
Example 4:<br />
&lt;?php<br />
error_reporting(E_ALL);<br />
$a = &#8216;I am test.&#8217;;<br />
$b = &amp; $a;</p>
<p>unset($b);</p>
<p>echo $a .”\n”;<br />
echo $b .”\n”;<br />
?&gt;<br />
其实如果 Example 3 理解了,这个与之异曲同工.<br />
<em>hy0kl% php -f gc.php<br />
I am test.<br />
Notice: Undefined variable: b in /usr/local/www/apache22/data/test/gc.php on line 9</em></p>
<p>君且看:<br />
Example 5:<br />
&lt;?php<br />
error_reporting(E_ALL);<br />
$a = &#8216;I am test.&#8217;;<br />
$b = &amp; $a;</p>
<p>$a = null;</p>
<p>echo &#8216;$a = &#8216;. $a .”\n”;<br />
echo &#8216;$b = &#8216;. $b .”\n”;<br />
?&gt;<br />
猛的第一感觉是什么样的?<br />
<em>hy0kl% php -f gc.php<br />
$a =<br />
$b =</em><br />
没错,这就是输出结果,对 PHP GC 已有深入理解的 phper 不会觉得有什么奇怪,说实话,当我第一次运行这段代码时很意外,却让我对 PHP GC 有更深刻的理解了.那么下面与之同工的例子自然好理解了.</p>
<p>Example 6:<br />
&lt;?php<br />
error_reporting(E_ALL);<br />
$a = &#8216;I am test.&#8217;;<br />
$b = &amp; $a;</p>
<p>$b = null;</p>
<p>echo &#8216;$a = &#8216;. $a .”\n”;<br />
echo &#8216;$b = &#8216;. $b .”\n”;<br />
?&gt;</p>
<p>下面我们来详细分析 GC 与引用.<br />
1. 所有例子中,创建了一个变量,这个过程通俗一点讲:是在内存中开辟了一块空间,在里面存放了一个字符串 <strong>I am test.</strong> . PHP 内部有个符号表,用来记录各块内存引用计数,那么此时会将这块内存的引用计数 <strong>加 1</strong>,并且用一个名为 $a 的标签(变量)<strong>指向</strong>这块内存,方便依标签名来操作内存.</p>
<p>2. 对变量 $a 进行 <strong>&amp;</strong> 操作,我的理解是找到 $a 所指向的内存,并为 $b 建立同样的一引用指向,并将存放字符串 <strong>I am test.</strong> 的内存块在符号表中引用计数 加 1.换言之,我们的脚本执行到这一行的时候,存放字符串 <strong>I am test.</strong> 的那块内存被引用了两次.这里要强调的是, <strong>&amp;</strong> 操作是建立了引用指向,而不是指针, PHP 没有指针的概念!同时有人提出说类似于 UNIX 的文件软链接.可以在一定程度上这么理解: 存放字符 <strong>I am test. </strong>的那块内存是我们的一个真实的文件,而变量 $a 与 $b 是针对真实文件建立的软链接,但它们指向的是同一个真实文件. So, 我们看到,在 Example 2   中给 $b 赋值的同时, $a 的值也跟着变化了.与通过某一软链操作了文件类似.</p>
<p>3. 在 Example 3 与 4 中,进行了 unset() 操作.根据实际的执行结果,可以看出: unset() 只是断开这个变量对它原先指向的内存的引用,使变量本身成为没有定义过空引用,所在调用时发出了 <em>Notice </em>,并且使那块内存在符号表中引用计数 减 1,并没有影响到其他指向这块内存的变量.换言之,只有当一块内存在符号表中的引用计数为 0 时, PHP 引擎才会将这块内存回收.</p>
<p>PHP 手册<br />
4.0.0                <strong>unset()</strong> became an expression. (In PHP 3,       <strong>unset()</strong> would always return 1).<br />
这意味着什么?<br />
看看下面的代码与其结果:<br />
&lt;?php<br />
error_reporting(E_ALL);<br />
$a = &#8216;I am test.&#8217;;<br />
$b = &amp; $a;</p>
<p>unset($a);<br />
unset($a);<br />
unset($a);</p>
<p>echo &#8216;$a = &#8216;. $a .”\n”;<br />
echo &#8216;$b = &#8216;. $b .”\n”;<br />
?&gt;<br />
<em>hy0kl% php -f gc.php</em></p>
<p>Notice: Undefined variable: a in /usr/local/www/apache22/data/test/gc.php on line 10<br />
$a =<br />
$b = I am test.<br />
第一次 unset() 的操作已经断开了指向,所以后继的操作不会对符号表的任何内存的引用记数造成影响了.</p>
<p>4. 通过 Example 5 &amp; 6 可以明确无误得出: 赋值 null操 作是相当猛的,它会直接将变量所指向的内存在符号号中的引用计数置 0,那这块内存自然被引擎回收了,至于何时被再次利用不得而知,有可能马上被用作存储别的信息,也许再也没有使用过.但是无论如何,原来所有指向那块内存 变量都将无法再操作被回收的内存了,任何试图调用它的变量都将返回 null.</p>
<p>&lt;?php<br />
error_reporting(E_ALL);<br />
$a = &#8216;I am test.&#8217;;<br />
$b = &amp; $a;</p>
<p>$b = null;</p>
<p>echo &#8216;$a = &#8216;. $a .”\n”;<br />
echo &#8216;$b = &#8216;. $b .”\n”;</p>
<p>if (null === $a)<br />
{<br />
echo &#8216;$a is null.&#8217;;<br />
} else<br />
{<br />
echo &#8216;The type of $a is unknown.&#8217;;<br />
}<br />
?&gt;<br />
<strong><em>hy0kl% php -f gc.php<br />
$a =<br />
$b =<br />
$a is null.</em></strong></p>
<p>综上所述,充分说明了为什么我们在看开源产品源码的时候,常看到一些比较大的临时变量,或使用完不再调用的重用信息都会被集中或显示的赋值为 <strong>null</strong> 了.它相当于 UNIX 中直接将真实文件干掉了,所有指向它的软链接自然成了空链了.<br />
之前在讨论到这些细节点时有很多想当然的念头,在实际的执行了测试代码后才发现: 哦,原来如此!<br />
纸上得来终觉浅,绝知此事须躬行.</p>
</div>
</div>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="PHP框架自动加载类的实现" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F749.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F769.html">
                        <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;">PHP框架自动加载类的实现</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="php中全等(===)和相等(==)的用法区别" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F722.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F769.html">
                        <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;">php中全等(===)和相等(==)的用法区别</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="收藏PHP常用函数" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2F%3Fp%3D736&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F769.html">
                        <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;">收藏PHP常用函数</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="十个PHP高级应用技巧" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F557.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F769.html">
                        <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;">十个PHP高级应用技巧</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP 扩展总结" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F643.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F769.html">
                        <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;">PHP 扩展总结</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><h2  class="related_post_title">随机推荐文章</h2><ul class="related_post"><li><a href="http://www.liangkun.net/archives/661.html" title="浅谈数据库系统中的cache">浅谈数据库系统中的cache</a></li><li><a href="http://www.liangkun.net/archives/457.html" title="金山张宴谈架构">金山张宴谈架构</a></li><li><a href="http://www.liangkun.net/archives/118.html" title="wordpress中轻松搞定对文章评论时添加表情图标">wordpress中轻松搞定对文章评论时添加表情图标</a></li><li><a href="http://www.liangkun.net/archives/749.html" title="PHP框架自动加载类的实现">PHP框架自动加载类的实现</a></li><li><a href="http://www.liangkun.net/archives/683.html" title="linux uniq命令:(过滤重复部分显示文件内容)">linux uniq命令:(过滤重复部分显示文件内容)</a></li><li><a href="http://www.liangkun.net/archives/234.html" title="vim和vi的区别">vim和vi的区别</a></li><li><a href="http://www.liangkun.net/archives/176.html" title="运维工作人员的大型网站探讨和心得">运维工作人员的大型网站探讨和心得</a></li><li><a href="http://www.liangkun.net/archives/77.html" title="如何让你的WordPress留言显示自定义头像">如何让你的WordPress留言显示自定义头像</a></li><li><a href="http://www.liangkun.net/archives/633.html" title="PHP在百度的应用现状及展望">PHP在百度的应用现状及展望</a></li><li><a href="http://www.liangkun.net/archives/534.html" title="网页中CSS文件链接<link src=""/>方式与嵌入<style></style>方式的区别？">网页中CSS文件链接<link src=""/>方式与嵌入<style></style>方式的区别？</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.liangkun.net/archives/769.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>vgmodify</title>
		<link>http://www.liangkun.net/archives/755.html</link>
		<comments>http://www.liangkun.net/archives/755.html#comments</comments>
		<pubDate>Sun, 13 Nov 2011 09:39:16 +0000</pubDate>
		<dc:creator>guojca</dc:creator>
				<category><![CDATA[HP-UX]]></category>

		<guid isPermaLink="false">http://www.liangkun.net/?p=755</guid>
		<description><![CDATA[修改卷组参数 在创建卷组时，会设置卷组的某些特性。使用 vgmodify 命令可以调整某些卷组参数，而不必 删除并重新创建卷组，也不必移动数据。vgmodify 命令允许您修改 1.0 版卷组和 2.x 版卷组的 不同参数。 对于 1.0 版卷组，可以使用 vgmodify 执行下列操作： • 检测和处理物理卷大小更改。 • 修改每个物理卷可分配的最大物理盘区数。 • 修改每个卷组可包含的最大物理卷数。 • 修改卷组可包含的最大逻辑卷数。 • 将磁盘类型从可引导磁盘更改为非引导磁盘（反之亦然）。 • 处理物理卷 LUN 扩展。 • 准备物理卷以进行 LUN 缩减。 对于 2.x 版卷组，可以使用 vgmodify 执行下列操作： • 检测和处理物理卷大小更改。 • 修改卷组的最大大小。 • 处理物理卷 LUN 扩展。 • 准备物理卷以进行 LUN 缩减。 从 2009 年 3 [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="新浪SAE如何绑定自定义的域名" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F790.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F755.html">
                        <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/04/15/19537383.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;">新浪SAE如何绑定自定义的域名</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="电脑如何一开机后，不用输入登录用户或密码直接进入桌面" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F664.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F755.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/30/15089855.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">电脑如何一开机后，不用输入登录用户或密码直接进入桌面</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="架构学习:四层和七层负载均衡的区别" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F776.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F755.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/12/27/13134880.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;">架构学习:四层和七层负载均衡的区别</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="大型网站架构心得体会" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F4.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F755.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/03/27590691.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">大型网站架构心得体会</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP的垃圾回收机制" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F769.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F755.html">
                        <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/03/30/18478356.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP的垃圾回收机制</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>修改卷组参数<br />
在创建卷组时，会设置卷组的某些特性。使用 vgmodify 命令可以调整某些卷组参数，而不必<br />
删除并重新创建卷组，也不必移动数据。vgmodify 命令允许您修改 1.0 版卷组和 2.x 版卷组的<br />
不同参数。<br />
对于 1.0 版卷组，可以使用 vgmodify 执行下列操作：<br />
• 检测和处理物理卷大小更改。<br />
• 修改每个物理卷可分配的最大物理盘区数。<br />
• 修改每个卷组可包含的最大物理卷数。<br />
• 修改卷组可包含的最大逻辑卷数。<br />
• 将磁盘类型从可引导磁盘更改为非引导磁盘（反之亦然）。<br />
• 处理物理卷 LUN 扩展。<br />
• 准备物理卷以进行 LUN 缩减。<span id="more-755"></span><br />
对于 2.x 版卷组，可以使用 vgmodify 执行下列操作：<br />
• 检测和处理物理卷大小更改。<br />
• 修改卷组的最大大小。<br />
• 处理物理卷 LUN 扩展。<br />
• 准备物理卷以进行 LUN 缩减。<br />
从 2009 年 3 月更新版开始，对于 1.0 版和 2.x 版卷组，可联机运行 vgmodify 命令（卷组处<br />
于激活状态且应用程序处于运行状态）。此外，对于 1.0 版卷组，vgmodify 可在卷组脱机（非<br />
激活状态）的情况下运行。<br />
用于 1.0 版卷组的 vgmodify<br />
对于 1.0 版卷组，可执行下列步骤来调整每个 PV 的最大 PE 数、VG 中的最大 PV 数以及 VG 中<br />
的最大 LV 数：<br />
1. 运行 vgmodify 收集有关卷组的信息。<br />
保存以下三个命令的输出：<br />
# vgmodify -o -r vgnn<br />
# vgmodify -v -t vgnn<br />
# vgmodify -v -n -t vgnn</p>
<p>-o 选项会尝试通过充分利用现有的 LVM 元数据空间对这些值进行优化。-t 选项可报告设<br />
置的优化范围而不重新计算物理盘区数目；通过 -n 选项可重新计算物理盘区的数目。<br />
2. 根据上一步中收集的信息，选择新的卷组参数值。<br />
3. 这些新值可能会增加每个物理卷上卷组保留区域 (VGRA) 的大小。VGRA 驻留在 LVM 标头<br />
中，因此增加其大小可能需要移动物理卷上第一个物理盘区的任何用户数据。使用 pvmove<br />
命令可将第一个物理盘区移动到其他位置。<br />
4. 按照新的设置运行带 -r 选项的 vgmodify 检查这些值。<br />
5. 如果需要，请停用卷组。<br />
提示： 从 2009 年 3 月的 HP-UX 更新版开始，可在卷组处于活动状态时运行 vgmodify。<br />
6. 运行不带 -r 选项的 vgmodify 提交新值。<br />
7. 如果需要，请激活卷组。运行 vgdisplay 命令验证设置是否已应用。<br />
示例：用于 1.0 版卷组的 vgmodify<br />
例如，希望向卷组 vg32 中添加更大的磁盘。希望增加每个物理卷的最大物理盘区数 (max_pe)<br />
和最大物理卷数 (max_pv)。以下是相关步骤：<br />
1. 运行 vgmodify 收集有关卷组的信息。<br />
保存以下三个命令的输出：<br />
# vgmodify -o -r vg32<br />
Current Volume Group settings:<br />
Max LV 255<br />
Max PV 16<br />
Max PE per PV 1016<br />
PE Size (Mbytes) 32<br />
VGRA Size (Kbytes) 176<br />
New configuration requires “max_pes” are increased from 1016 to 6652<br />
The current and new Volume Group parameters differ.<br />
An update to the Volume Group IS required<br />
New Volume Group settings:<br />
Max LV 255<br />
Max PV 16<br />
Max PE per PV 6652<br />
PE Size (Mbytes) 32<br />
VGRA Size (Kbytes) 896<br />
Review complete. Volume group not modified<br />
# vgmodify -v -t vg32<br />
Current Volume Group settings:<br />
Max LV 255<br />
Max PV 16<br />
Max PE per PV 1016<br />
PE Size (Mbytes) 32<br />
VGRA Size (Kbytes) 176<br />
VGRA space (Kbytes) on Physical Volumes with extents in use:<br />
PV current -n<br />
/dev/rdisk/disk6 896 32768<br />
/dev/rdisk/disk5 896 32768<br />
Summary 896 32768<br />
Volume Group optimized settings (no PEs renumbered):<br />
max_pv(-p) max_pe(-e) Disk size (Mb)<br />
2 53756 1720193<br />
3 35836 1146753<br />
&#8230;<br />
213 296 9473<br />
255 252 8065<br />
# vgmodify -v -n -t vg32<br />
Volume Group configuration for /dev/vg32 has been saved in<br />
/etc/lvmconf/vg32.conf</p>
<p>Current Volume Group settings:<br />
Max LV 255<br />
Max PV 16<br />
Max PE per PV 1016<br />
PE Size (Mbytes) 32<br />
VGRA Size (Kbytes) 176<br />
VGRA space (Kbytes) on Physical Volumes with extents in use:<br />
PV current -n<br />
/dev/rdisk/disk6 896 32768<br />
/dev/rdisk/disk5 896 32768<br />
Summary 896 32768<br />
Physical Extent zero is not free on all PVs. You will not achieve these<br />
values until the first extent is made free (see pvmove(1M)) on all the<br />
following disks:<br />
/dev/rdisk/disk6<br />
/dev/rdisk/disk5<br />
Volume Group optimized settings (PEs renumbered lower):<br />
max_pv(-p) max_pe(-e) Disk size (Mb)<br />
61 65535 2097152<br />
62 65532 2097056<br />
&#8230;<br />
252 16048 513568<br />
255 15868 507808<br />
2. 根据 vgmodify -n -t 的输出，为 max_pv 和 max_pe 分别选择 255 和 15868。<br />
3. 由于新值要求物理盘区 0 可用，请使用 pvmove 将其移动到其他位置：<br />
# pvmove /dev/disk/disk5:0 /dev/disk/disk5<br />
Transferring logical extents of logical volume “/dev/vg32/lvol2&#8243;&#8230;<br />
Physical volume “/dev/disk/disk5&#8243; has been successfully moved.<br />
Volume Group configuration for /dev/vg32 has been saved in<br />
/etc/lvmconf/vg32.conf<br />
# pvmove /dev/disk/disk6:0 /dev/disk/disk6<br />
Transferring logical extents of logical volume “/dev/vg32/lvol1&#8243;&#8230;<br />
Physical volume “/dev/disk/disk6&#8243; has been successfully moved.<br />
Volume Group configuration for /dev/vg32 has been saved in<br />
/etc/lvmconf/vg32.conf<br />
4. 使用带 -r 选项的 vgmodify 预览更改：<br />
# vgmodify -p 255 -e 15868 -r -n vg32<br />
Current Volume Group settings:<br />
Max LV 255<br />
Max PV 16<br />
Max PE per PV 1016<br />
PE Size (Mbytes) 32<br />
VGRA Size (Kbytes) 176<br />
The current and new Volume Group parameters differ.<br />
An update to the Volume Group IS required<br />
New Volume Group settings:<br />
Max LV 255<br />
Max PV 255<br />
Max PE per PV 15868<br />
PE Size (Mbytes) 32<br />
VGRA Size (Kbytes) 32640<br />
Review complete. Volume group not modified<br />
5. 停用卷组：<br />
# vgchange -a n vg32<br />
Volume group “vg32&#8243; has been successfully changed.<br />
6. 提交新值：<br />
# vgmodify -p 255 -e 15868 -n vg32<br />
Current Volume Group settings:</p>
<p>Max LV 255<br />
Max PV 16<br />
Max PE per PV 1016<br />
PE Size (Mbytes) 32<br />
VGRA Size (Kbytes) 176<br />
The current and new Volume Group parameters differ.<br />
An update to the Volume Group IS required<br />
New Volume Group settings:<br />
Max LV 255<br />
Max PV 255<br />
Max PE per PV 15868<br />
PE Size (Mbytes) 32<br />
VGRA Size (Kbytes) 32640<br />
New Volume Group configuration for “vg32&#8243; has been saved in<br />
“/etc/lvmconf/vg32.conf”<br />
Old Volume Group configuration for “vg32&#8243; has been saved in<br />
“/etc/lvmconf/vg32.conf.old”<br />
Starting the modification by writing to all Physical Volumes<br />
Applying the configuration to all Physical Volumes from<br />
“/etc/lvmconf/vg32.conf”<br />
Completed the modification process.<br />
New Volume Group configuration for “vg32&#8243; has been saved in<br />
“/etc/lvmconf/vg32.conf.old”<br />
Volume group “vg32&#8243; has been successfully changed.<br />
7. 激活卷组并验证更改：<br />
# vgchange -a y vg32<br />
Activated volume group<br />
Volume group “vg32&#8243; has been successfully changed.<br />
# vgdisplay vg32<br />
&#8212; Volume groups &#8212;<br />
VG Name /dev/vg32<br />
VG Write Access read/write<br />
VG Status available<br />
Max LV 255<br />
Cur LV 0<br />
Open LV 0<br />
Max PV 255<br />
Cur PV 2<br />
Act PV 2<br />
Max PE per PV 15868<br />
VGDA 4<br />
PE Size (Mbytes) 32<br />
Total PE 1084<br />
Alloc PE 0<br />
Free PE 1084<br />
Total PVG 0<br />
Total Spare PVs 0<br />
Total Spare PVs in use 0<br />
VG Version 1.0<br />
用于 2.x 版卷组的 vgmodify<br />
如果需要增大卷组的最大大小（在通过 vgcreate 命令创建 2.x 版卷组时选择该大小），可使<br />
用 vgmodify -S 选项来增大卷组的最大大小。<br />
例如，需要增大最大卷组的大小，以便能够通过 vgextend 命令或 LUN 扩展向卷组中添加更多<br />
盘区（请参阅 vgmodify -E 选项）。<br />
也可通过 vgmodify -S 选项减小卷组的最大大小，以便物理卷能提供更多的盘区。<br />
增大卷组的最大大小可能需要将更多空间通过 LUN 扩展添加到每个物理卷。这种情况下，可以<br />
同时调用 -E 和 -S 选项，以便只需一步即可处理 LUN 扩展和增大 VG 最大大小。</p>
<p>LVM 也可能会使用物理卷末尾的可用盘区来增大卷组的最大大小。如果某些物理卷的末尾没有足<br />
够的可用盘区且这些物理卷不能通过 LUN 扩展来作进一步的扩展，则可能需要通过使用 pvmove<br />
命令来释放这些物理卷末尾的盘区，以便重新定位正在使用这些盘区的逻辑卷。<br />
使用 vgmodify -S 选项增大卷组的最大大小时，请注意只有在重新配置卷组中的所有物理卷<br />
后，才会增大卷组的最大大小。<br />
使用 vgmodify -S 选项减小卷组的最大大小时，请注意会在重新配置物理卷前减小卷组的最大<br />
大小。<br />
要增大 2.x 版卷组的最大大小，请执行下列步骤：<br />
1. 使用 vgmodify 审阅模式验证所有物理卷是否有足够的可用空间，以将它们重新配置为所<br />
需的更大 VG 最大大小。vgmodify 命令将检查可利用的 PV 末尾的可用盘区，并检查之前<br />
LUN 扩展所产生的可用空间。您必须为审阅模式提供 -E 选项和 -S 选项，以便检查 LUN 扩<br />
展。可能需要使用 pvmove 命令来重新定位位于 PV 末尾的逻辑卷。<br />
# vgmodify -r -a -E -S 64t vg1<br />
2. 如果审阅模式指明可以增大 VG 的最大大小，则执行实际的重新设置配置。该操作会将 VG<br />
中的每个 PV 重新配置为新的（更大的）VG 最大大小。该操作还会自动将新盘区添加到 PV<br />
中（其中新的盘区先前由于卷组已达到其最大盘区数而未被添加）。<br />
# vgmodify -a -E -S 64t vg1<br />
3. 通过运行 vgdisplay -v 命令验证重新设置配置的结果，以检查新的 VG 最大大小，新的<br />
VG 最大盘区数以及可能已添加到某些 PV 中的其他盘区。<br />
4. 如果任何 vgextend 先前无法将 PV 添加到卷组中，则现在重新运行这些命令。vgextend<br />
命令必须能将更多的 PV 成功添加到 VG 中。运行 vgdisplay -v 验证现在是否有更多空<br />
闲盘区可用。<br />
5. 根据需要使用 lvextend -l 扩展逻辑卷，以允许它们容纳更多用户数据。也可通过使用<br />
lvcreate 来创建更多逻辑卷。还可以通过使用 lvextend -m 添加更多镜像。<br />
要减小 2.x 版卷组的最大卷组大小，请执行下列步骤：<br />
1. 使用 vgmodify 的审阅模式验证是否可以将卷组的最大大小减小为所需的较小值。<br />
# vgmodify -r -a -S 32t vg1<br />
2. 如果审阅模式指明可以减小 VG 的最大大小，则执行实际的重新设置配置。vgmodify 命令<br />
将重新配置 VG 中的每个 PV，以减小用于 LVM 配置数据的空间大小。未使用的空间将变为<br />
新盘区，用于保存用户数据。<br />
# vgmodify -a -S 32t vg1<br />
3. 通过运行 vgdisplay -v 命令验证重新设置配置的结果，以便检查新的 VG 最大大小，新<br />
的 VG 最大盘区数、新的 VG 盘区总数以及新的 VG 可用盘区数。<br />
示例：用于 2.x 版卷组的 vgmodify<br />
下面是一个当卷组达到其最大卷组大小限制时的联机重新设置示例。在该示例中，vgmodify<br />
-S 选项用于增加已达到其最大 VG 大小限制的 2.x 卷组的最大 VG 大小。下面是方案：<br />
卷组 /dev/vg1 有两个物理卷：/dev/disk/disk46 和 /dev/disk/disk47。<br />
物理卷 /dev/disk/disk46 当前有 38398 个盘区，且该物理卷末尾的一些盘区是可用盘区。<br />
物理卷 /dev/disk/disk47 当前有 25602 个盘区。卷组当前有 64000 个盘区 (38398 +<br />
25602 = 64000)。<br />
vgdisplay 所示的 VG 最大大小是 500 GB。卷组中的最大盘区数为 64000。<br />
diskinfo 命令显示这两个物理卷的大小均为约 300 GB。然而，由于最大 VG 大小仅为 500<br />
GB，因此 /dev/disk/disk47 上大约有 100 GB 当前不可用。此外，通过 vgextend 命令尝<br />
试添加更多物理卷的操作将失败，因为卷组已经达到其最大 VG 大小限制。<br />
要使 /dev/disk/disk47 上的全部 300 GB 可用，且允许通过 vgextend 命令将更多物理卷<br />
添加到卷组，可使用 vgmodify -S 选项增大 VG 最大大小。在该示例中，最大大小从 500 GB<br />
增加到 8 TB，以便有足够的增长空间。以下是相关步骤：</p>
<p>1. 运行 vgdisplay，该命令显示的 VG 最大大小为 500 GB 且卷组的最大盘区数（由 VG 的<br />
最大大小确定）是 64000。<br />
# vgdisplay -v vg1<br />
&#8212; Volume groups &#8212;<br />
VG Name /dev/vg1<br />
&#8230;<br />
VG Version 2.1<br />
VG Max Size 500 GB<br />
VG Max Entents 64000<br />
&#8230;<br />
2. 对物理卷运行 diskinfo 以显示它们的大小。<br />
# diskinfo /dev/rdisk/disk46<br />
# diskinfo /dev/rdisk/disk47<br />
3. 在审阅模式下联机运行 vgmodify 来验证是否所有物理卷都可重新配置为新的（更大的）<br />
VG 最大大小 (8 TB)。<br />
# vgmodify -r -a -E -S 8t vg1<br />
Physical volume “/dev/disk/disk46&#8243; requires reconfiguration to be<br />
provisioned to the requested maximum volume group size 8388608 MB.<br />
Current number of extents: 38398<br />
Number of extents after reconfiguration: 38396<br />
&#8230;<br />
Physical volume “/dev/disk/disk46&#8243; was not changed.<br />
Physical volume “/dev/disk/disk4&#8243; requires reconfiguration to be<br />
provisioned to the requested maximum volume group size 8388608 MB.<br />
Current number of extents: 25602<br />
Number of extents after reconfiguration: 25602<br />
&#8230;<br />
Physical volume “/dev/disk/disk47&#8243; was not changed.<br />
在该示例中，卷组中的所有物理卷都可重新配置，所以 /dev/vg1 的最大卷组大小可以从<br />
500 GB 增大到 8 TB。<br />
请注意，这两个空闲盘区将用于对 /dev/disk/disk46 进行重新配置，从而将物理卷上的<br />
盘区数从 38398 减小至 38396。<br />
4. 请注意，当在更改模式下运行 vgmodify -S 选项时，将向 /dev/disk/disk47 添加其<br />
他盘区，如下所示。<br />
# vgmodify -a -E -S 8t vg1<br />
Reconfiguration of physical volume “/dev/disk/disk46&#8243; for the<br />
requested maximum volume group size 8388608 MB succeeded.<br />
Previous number of extents: 38398<br />
Number of extents after reconfiguration: 38396<br />
Physical volume “/dev/disk/disk46&#8243; was changed.<br />
Volume Group configuration for /dev/vg1 has been saved in<br />
/etc/lvmconf/vg1.conf<br />
Reconfiguration of physical volume “/dev/disk/disk47&#8243; for the<br />
requested maximum volume group size 8388608 MB succeeded.<br />
Previous number of extents: 25604<br />
Number of extents after reconfiguration: 25604<br />
Physical volume “/dev/disk/disk47&#8243; was changed.<br />
The maximum volume group size for “/dev/vg1&#8243; has been<br />
increased from 512000 MB to 8388608 MB.<br />
Volume Group configuration for /dev/vg1 has been saved in<br />
/etc/lvmconf/vg1.conf</p>
<p>正如审阅模式所示，已从 /dev/disk/disk46 中取走两个盘区以进行重新配置（从 38398<br />
减小至 38396）。该操作允许在增加最大卷组大小前将两个盘区添加到 /dev/disk/disk47<br />
中（从 25602 增加至 25604）<br />
5. 请注意，增加 VG 最大大小后，/dev/disk/disk47 的盘区数从 25604 增加至 38396，<br />
如 vgdisplay -v 所示。该命令确认 VG 最大大小已从 500 GB 增加至 8 TB，且 /dev/<br />
disk/disk47 的盘区数已从 25602 增加至 38396，如下面的 vgdisplay 命令所示。<br />
# vgdisplay –v vg1<br />
&#8212; Volume groups &#8212;<br />
VG Name /dev/vg1<br />
&#8230;<br />
PE Size (Mbytes) 8<br />
Total PE 76792<br />
Alloc PE 51196<br />
Free PE 25596<br />
&#8230;<br />
VG Version 2.1<br />
VG Max Size 8t<br />
VG Max Extents 1048576<br />
&#8212; Logical volumes &#8212;<br />
LV Name /dev/vg1/lvol1<br />
LV Status available/syncd<br />
LV Size (Mbytes) 204784<br />
Current LE 25598<br />
Allocated PE 51196<br />
Used PV 2<br />
&#8212; Physical volumes &#8212;<br />
PV Name /dev/disk/disk46<br />
PV Status available<br />
Total PE 38396<br />
Free PE 12798<br />
&#8230;<br />
PV Name /dev/disk/disk47<br />
PV Status available<br />
Total PE 38396<br />
Free PE 12798</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="网易域名邮箱初次使用体验" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F103.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F755.html">
                        <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/05/04/7492938.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">网易域名邮箱初次使用体验</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress高亮代码插件WP-CodeBox" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F738.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F755.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/08/21672421.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress高亮代码插件WP-CodeBox</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="如何理解缓存" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F531.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F755.html">
                        <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/05/04/7492827.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何理解缓存</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="欧洲“寨主”如何成为亿万富翁" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F582.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F755.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/30/15228072.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">欧洲“寨主”如何成为亿万富翁</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Nginx源码学习" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F781.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F755.html">
                        <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/04/05/18849628.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;">Nginx源码学习</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><h2  class="related_post_title">随机推荐文章</h2><ul class="related_post"><li><a href="http://www.liangkun.net/archives/38.html" title="用JS实现非常棒的图片效果">用JS实现非常棒的图片效果</a></li><li><a href="http://www.liangkun.net/archives/34.html" title="如何更改IE中的收藏夹中所有链接所在位置">如何更改IE中的收藏夹中所有链接所在位置</a></li><li><a href="http://www.liangkun.net/archives/531.html" title="如何理解缓存">如何理解缓存</a></li><li><a href="http://www.liangkun.net/archives/578.html" title="CHINAZ创始人阿飞谈站长与创业者">CHINAZ创始人阿飞谈站长与创业者</a></li><li><a href="http://www.liangkun.net/archives/271.html" title="什么是VPS（Virtual Private Server 虚拟专用服务器）">什么是VPS（Virtual Private Server 虚拟专用服务器）</a></li><li><a href="http://www.liangkun.net/archives/413.html" title="卓越网CEO的幸福生活">卓越网CEO的幸福生活</a></li><li><a href="http://www.liangkun.net/archives/196.html" title="互联网十大商业模式">互联网十大商业模式</a></li><li><a href="http://www.liangkun.net/archives/103.html" title="网易域名邮箱初次使用体验">网易域名邮箱初次使用体验</a></li><li><a href="http://www.liangkun.net/archives/69.html" title="百度广告管家-免费网站广告管理系统">百度广告管家-免费网站广告管理系统</a></li><li><a href="http://www.liangkun.net/archives/454.html" title="以实例说明域名A记录与泛解析的联系与区别">以实例说明域名A记录与泛解析的联系与区别</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.liangkun.net/archives/755.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Linux 下批量建立目录</title>
		<link>http://www.liangkun.net/archives/751.html</link>
		<comments>http://www.liangkun.net/archives/751.html#comments</comments>
		<pubDate>Tue, 08 Nov 2011 16:11:35 +0000</pubDate>
		<dc:creator>zhang</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.liangkun.net/?p=751</guid>
		<description><![CDATA[先看看示例吧: [wind@windphp test]$ mkdir {1..9} [wind@windphp test]$ ls 1 2 3 4 5 6 7 8 9 [wind@windphp test]$ mkdir {a..z} [wind@windphp test]$ ls 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t 首先是建立1-9的9个目录, 然后是是a-z的26个目录, [...]<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="linux的chmod与chown命令使用及区别" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F230.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F751.html">
                        <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;">linux的chmod与chown命令使用及区别</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="Linux性能分析工具(vmstat,iostat,sar)" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F658.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F751.html">
                        <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;">Linux性能分析工具(vmstat,iostat,sar)</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="linux下的crontab 使用说明及案例" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F420.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F751.html">
                        <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;">linux下的crontab 使用说明及案例</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="Linux下zip包如何进行打包和解压小结" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F602.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F751.html">
                        <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;">Linux下zip包如何进行打包和解压小结</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="linux 下 tar 压缩和解压命令" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F207.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F751.html">
                        <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;">linux 下 tar 压缩和解压命令</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>先看看示例吧:</p>
<pre class="brush:php">
[wind@windphp test]$ mkdir {1..9}
[wind@windphp test]$ ls
1  2  3  4  5  6  7  8  9
[wind@windphp test]$ mkdir {a..z}
[wind@windphp test]$ ls
1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t
</pre>
<p>首先是建立1-9的9个目录, 然后是是a-z的26个目录, 这里的范围是可以自定的, 当然了, 范围要合理, 比如字母范围如果是双数就不行了哦.</p>
<p>如果是乱序的, 就麻烦点了. 如下:</p>
<pre class="brush:php">
[wind@windphp test]$ mkdir {a,1,5}
[wind@windphp test]$ ls
1  5  a
</pre>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="linux的chmod与chown命令使用及区别" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F230.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F751.html">
                        <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;">linux的chmod与chown命令使用及区别</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="Linux性能分析工具(vmstat,iostat,sar)" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F658.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F751.html">
                        <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;">Linux性能分析工具(vmstat,iostat,sar)</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="linux下的crontab 使用说明及案例" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F420.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F751.html">
                        <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;">linux下的crontab 使用说明及案例</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="Linux下zip包如何进行打包和解压小结" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F602.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F751.html">
                        <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;">Linux下zip包如何进行打包和解压小结</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="linux 下 tar 压缩和解压命令" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F207.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F751.html">
                        <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;">linux 下 tar 压缩和解压命令</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><h2  class="related_post_title">【相关文章推荐】</h2><ul class="related_post"><li><a href="http://www.liangkun.net/archives/658.html" title="Linux性能分析工具(vmstat,iostat,sar)">Linux性能分析工具(vmstat,iostat,sar)</a></li><li><a href="http://www.liangkun.net/archives/602.html" title="Linux下zip包如何进行打包和解压小结">Linux下zip包如何进行打包和解压小结</a></li><li><a href="http://www.liangkun.net/archives/420.html" title="linux下的crontab 使用说明及案例">linux下的crontab 使用说明及案例</a></li><li><a href="http://www.liangkun.net/archives/230.html" title="linux的chmod与chown命令使用及区别">linux的chmod与chown命令使用及区别</a></li><li><a href="http://www.liangkun.net/archives/220.html" title="    VI常用实用命令学习  ">    VI常用实用命令学习  </a></li><li><a href="http://www.liangkun.net/archives/207.html" title="linux 下 tar 压缩和解压命令">linux 下 tar 压缩和解压命令</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.liangkun.net/archives/751.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>PHP框架自动加载类的实现</title>
		<link>http://www.liangkun.net/archives/749.html</link>
		<comments>http://www.liangkun.net/archives/749.html#comments</comments>
		<pubDate>Wed, 26 Oct 2011 03:03:09 +0000</pubDate>
		<dc:creator>zhang</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.liangkun.net/?p=749</guid>
		<description><![CDATA[PHP框架 如果包含一般文件较少的情况会用手动包含要使用的类文件 当要包含大量类文件的时候，这样就会显得麻烦，就可以使用自动包含类。 类文件：test.php class Test { public function __construct() { echo __CLASS__.__FUNCTION__; } } 1.手动包含： require_once('test.php'); $test = new Test(); 2.使用__autoload()自动包含: // 这样实例化一个类的时候，将会自动包含同名的类文件 // 需要重载__autoload方法，自定义包含类文件的路径 function __autoload($classname) { $class_file = strtolower($classname).".php"; if (file_exists($class_file)){ require_once($class_file); } } $test = new Test(); 3.使用spl_autoload_register() 自定义的方法来加载文件 语法：bool spl_autoload_register ( [callback $autoload_function] ) function myLoader($classname) { $class_file = strtolower($classname).".php"; [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="十个PHP高级应用技巧" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F557.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F749.html">
                        <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;">十个PHP高级应用技巧</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="收藏PHP常用函数" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2F%3Fp%3D736&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F749.html">
                        <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;">收藏PHP常用函数</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="如何才能称之为良好的php代码" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F667.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F749.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/23/24351602.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何才能称之为良好的php代码</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP获取163邮箱联系人" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F559.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F749.html">
                        <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;">PHP获取163邮箱联系人</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="PHP5和Zend Optimizer 基础安装教程" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F89.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F749.html">
                        <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/05/04/7493052.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;">PHP5和Zend Optimizer 基础安装教程</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><strong>PHP框架 如果</strong><strong>包含一般文件较少的情况会用手动包含要使用的类文件<br />
当要包含大量类文件的时候，这样就会显得麻烦，就可以使用自动包含类。</strong></p>
<p>类文件：test.php</p>
<pre class="brush:php">
class Test
{
    public function __construct()
   {
       echo __CLASS__.__FUNCTION__;
    }
 }
</pre>
<p>1.手动包含：</p>
<pre class="brush:php">
    require_once('test.php');
    $test = new Test();
</pre>
<p>2.使用__autoload()自动包含: </p>
<pre class="brush:php">
    // 这样实例化一个类的时候，将会自动包含同名的类文件
    // 需要重载__autoload方法，自定义包含类文件的路径
    function __autoload($classname)
    {
        $class_file = strtolower($classname).".php";
        if (file_exists($class_file)){
            require_once($class_file);
       }
    }
    $test = new Test();
</pre>
<p> <span id="more-749"></span></p>
<p>3.使用spl_autoload_register() 自定义的方法来加载文件<br />
语法：bool  spl_autoload_register ( [callback $autoload_function] )</p>
<pre class="brush:php">
    function myLoader($classname)
   {
       $class_file = strtolower($classname).".php";
       if (file_exists($class_file)){
           require_once($class_file);
       }
  }
  // 注册自定义方法
  spl_autoload_register("myLoader");  

  $test = new Test();
</pre>
<p>也可以使用类的方法来实现自定义的加载函数 </p>
<pre class="brush:php">
 class autoLoader
 {
    public static function myLoader($classname)
     {
         $class_file = strtolower($classname).".php";
         if (file_exists($class_file)){
             require_once($class_file);
         }
     }
 }  

 // 通过数组的形式传递类和方法，元素一为类名称、元素二为方法名称
// 方法为静态方法
 spl_autoload_register(array("autoLoader","myLoader"));  

 $test = new Test();
</pre>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="十个PHP高级应用技巧" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F557.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F749.html">
                        <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;">十个PHP高级应用技巧</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="收藏PHP常用函数" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2F%3Fp%3D736&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F749.html">
                        <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;">收藏PHP常用函数</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="如何才能称之为良好的php代码" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F667.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F749.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/23/24351602.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何才能称之为良好的php代码</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP获取163邮箱联系人" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F559.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F749.html">
                        <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;">PHP获取163邮箱联系人</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="PHP5和Zend Optimizer 基础安装教程" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F89.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F749.html">
                        <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/05/04/7493052.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;">PHP5和Zend Optimizer 基础安装教程</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><h2  class="related_post_title">【相关文章推荐】</h2><ul class="related_post"><li><a href="http://www.liangkun.net/archives/736.html" title="收藏PHP常用函数">收藏PHP常用函数</a></li><li><a href="http://www.liangkun.net/archives/724.html" title="PHP开发人员如何突破成长瓶颈">PHP开发人员如何突破成长瓶颈</a></li><li><a href="http://www.liangkun.net/archives/722.html" title="php中全等(===)和相等(==)的用法区别">php中全等(===)和相等(==)的用法区别</a></li><li><a href="http://www.liangkun.net/archives/635.html" title="php函数call_user_func和call_user_func_array详解 ">php函数call_user_func和call_user_func_array详解 </a></li><li><a href="http://www.liangkun.net/archives/633.html" title="PHP在百度的应用现状及展望">PHP在百度的应用现状及展望</a></li><li><a href="http://www.liangkun.net/archives/559.html" title="PHP获取163邮箱联系人">PHP获取163邮箱联系人</a></li><li><a href="http://www.liangkun.net/archives/557.html" title="十个PHP高级应用技巧">十个PHP高级应用技巧</a></li><li><a href="http://www.liangkun.net/archives/536.html" title="mysql_fetch_assoc和 mysql_fetch_array的区别">mysql_fetch_assoc和 mysql_fetch_array的区别</a></li><li><a href="http://www.liangkun.net/archives/479.html" title="PHP中的PDO安装及使用方法">PHP中的PDO安装及使用方法</a></li><li><a href="http://www.liangkun.net/archives/483.html" title="Discuz7.0程序二次开发必备：目录详解">Discuz7.0程序二次开发必备：目录详解</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.liangkun.net/archives/749.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>前腾讯员工离职三个月开发出 app store排名第一应用疯狂猎鸟的总结</title>
		<link>http://www.liangkun.net/archives/746.html</link>
		<comments>http://www.liangkun.net/archives/746.html#comments</comments>
		<pubDate>Sat, 22 Oct 2011 04:40:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[web开发]]></category>

		<guid isPermaLink="false">http://www.liangkun.net/?p=746</guid>
		<description><![CDATA[光荣与梦想 — 疯狂猎鸟项目小结 半年前我离开了腾讯，加入了豪腾嘉科。 至今难以忘记在离开腾讯前，以前的leader用一高一低两个手给我比划的手势，告诉我，我现在是在多么高的位置（意指腾讯），要去的创业公司是多么低的 位置，告诉我，你现在一时决定这么掉下去，也许永远就再也回不去那么高的位置了。但是我还是决定出来了，原因在以前的一篇总结中 有较为详细的描述，那时，我能够谈的最多的就是梦想，很感谢那时候大家的支持，而今天，我要谈的，还有光荣！现在看来，这个决定实在是太正确了。因为，假 如我没有出来，按在腾讯的原计划，我还是在为一个无聊的纸牌游戏做着更多无聊的更新，而我出来后，在豪腾嘉科组建了自己的新团队，开发出了一款新的 iPad游戏“疯狂猎鸟”，从2011年9月28日开始，“疯狂猎鸟”在iPad App Store中国区总榜排名持续第一长达一周！iphone版本上架两天后，即到达iphone app store中国区总榜第二名。 也许所有iOS程序员都有一个梦想，那就是做出排在app store榜首的app，这种梦想也许就像是NBA球员对总冠军戒指的渴望一样。依托于强大的平台，几乎每款以前我参与制作的iOS产品，最终都能在 app store排行榜上登顶，从在gameloft时参与开发的spiderman for iphone到在腾讯时的斗地主 for iphone/ipad，无不如此。当我自己开始组建新团队的时候，虽然也是奔着做榜首产品去的，只是我做梦也没有想到，这一刻会来的这么快，疯狂猎鸟是 我们团队组建以来的第一款游戏，而我们团队从组建到现在还不到3个月，至今，不是看着上面的截图，都会觉得这个现实太过梦幻。 每一款产品背后都有很多不为人知的故事，而每一款成功的产品背后，故事却往往不如人们想象的光鲜靓丽。我很想记录下疯狂猎鸟的诞生过程，以期这段历 史不会 被移动市场的波澜壮阔而埋没，因为疯狂猎鸟诞生的过程，也是移动大潮中一朵异常精彩的浪花。但是……我会觉得已经不能像以前那样可以完全放肆的自述己见， 因为，当我从事的工作慢慢从与技术打交道到与人打交道的时候，在总结中，我需要描述的是一个团队，甚至一个公司管理上的得与失，而不再是自己一个人技术上 那些天马行空的想法，并且，写下来后，我还得考虑每个当事人的心里感受了。其中牵涉的人与事太多，怕因为自己处理不了这种复杂度，有可能伤害了其他人的感 情，有可能写着像自我陶醉似的拔高自己，还有可能需要矫揉造作的去写些无关痛痒的客套话～～～可能类似的故事，只适合写小说，而不是当事人的回忆录吧。 也许，未来的某一天，这些故事尘封已久，大家都已经不会再在意的时候，我再来把这段值得铭记的故事写下来吧。 也许，当我开始有这样感觉的时候，我已经慢慢脱离了一个纯粹程序员的角色….. 再也许，我的下一篇总结，不能再以小小游戏程序员的工作总结来命名了，因为那样读者进来看到的会是文不对题的内容，然后咒骂我是标题党了。 以下还是不按照时间顺序事无巨细的描述了，还是想到哪写到哪吧。 团队组建 我的全部工作便是选择适当的人”– 韦尔奇 我是一个人从原公司唯一的团队中出来的，在团队组建之初只有我一个人加美术 zhaoruny（那时候他还刚刚进公司），可以算是从零开始，虽然那时候公司名义上也算是两个团队了，但是实际上我们团队完全就没法算一个团队，于是组 建一个较为完整的团队就是我最重要的任务了。而很显然的事实时，作为创业公司，招聘远没有一个名声在外的成熟大公司那么容易。（想想那一个手势就知道了） 这段时间我联系了一些非常优秀的人，但是因为各种原因，他们最终没有选择加入我们团队，这其中，最大的原因就是地理因素和家庭因素，还有两者的结合，比如父母或者女朋友不希望他到北京，离家/她太远，而是希望留在身边。 对于他们我个人是非常的遗憾，他们是非常优秀的年轻人，有着不可估量的发展潜力，但是因为家庭/女朋友的原因，放弃了真正的发展机会（我一直和他们 说，即 使你觉得我们公司不好，也应该来北京或者去上海，因为只有这里才有你们的用武之地）最后无奈的选择了在一个小城市工作。遗憾归遗憾吧，虽然从技术方面看我 觉得他们要能来我们公司对公司的发展非常的有帮助，但是那种担心受怕，连一点险都不愿意冒并且还受父母/女朋友控制的人，也许其实从性格上来说并不一定适 合我们创业团队吧。的确，当一个成年的男子汉，不能顶天立地则罢了，还会说自己在哪工作不由自己决定，这个实在是让我无法接受…… 我从来都知道北京的生活压力大，但是也一直认为动力就来自于压力，在没有压力的环境下，人容易变得懒散（其实我就是一个非常懒散的人，但是来北京后 被人称 为学习工作过于自虐），而年轻的时候不奋斗，难道真的想去印证“少壮不努力，一生在内地;年少不拼搏，老死在中国；英语学不牢，世代在天朝；学习不刻苦， 永远在大陆”这句话吗？ 对此，我送他们一首诗，多看看这首诗，趁还有年轻热血的时候想想，是要选择就此老死在家乡，还是去远方建功立业。 男儿立志出乡关， 学不成名死不还。 埋骨何须桑梓地， 人生无处不青山。 ——西乡隆盛诗 虽然远方也不一定是美好的，风险也是存在的，但是我还是坚定的认为，用自己的时间和努力来换取人生的另外一种可能是完全值得的，人的一生要有一次为自己的梦想而竭尽全力！ [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="如何在PHP网站开发中，指定任意文件扩展名使用PHP解析" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F16.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F746.html">
                        <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/05/04/7493183.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何在PHP网站开发中，指定任意文件扩展名使用PHP解析</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="大型网站架构心得体会" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F4.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F746.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/03/27590691.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">大型网站架构心得体会</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="session和cookie原理及使用小结" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F93.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F746.html">
                        <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/05/04/7492795.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;">session和cookie原理及使用小结</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="剖析各大网站常用CSS图片技术—-CSS sprites" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F172.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F746.html">
                        <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/05/04/7492609.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;">剖析各大网站常用CSS图片技术—-CSS sprites</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="Session与cookie  原理及使用小结 (2)" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F97.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F746.html">
                        <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;">Session与cookie  原理及使用小结 (2)</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[<h2>光荣与梦想 — 疯狂猎鸟项目小结</h2>
<p>半年前我离开了腾讯，加入了豪腾嘉科。<br />
至今难以忘记在离开腾讯前，以前的leader用一高一低两个手给我比划的手势，告诉我，我现在是在多么高的位置（意指腾讯），要去的创业公司是多么低的 位置，告诉我，你现在一时决定这么掉下去，也许永远就再也回不去那么高的位置了。但是我还是决定出来了，原因在以前的一篇总结中  有较为详细的描述，那时，我能够谈的最多的就是梦想，很感谢那时候大家的支持，而今天，我要谈的，还有光荣！现在看来，这个决定实在是太正确了。因为，假  如我没有出来，按在腾讯的原计划，我还是在为一个无聊的纸牌游戏做着更多无聊的更新，而我出来后，在豪腾嘉科组建了自己的新团队，开发出了一款新的  iPad游戏“疯狂猎鸟”，从2011年9月28日开始，“疯狂猎鸟”在iPad App  Store中国区总榜排名持续第一长达一周！iphone版本上架两天后，即到达iphone app store中国区总榜第二名。<span id="more-746"></span></p>
<p><a href="http://www.mysqlops.com/wp-content/uploads/2011/10/game.png"><img src="http://www.mysqlops.com/wp-content/uploads/2011/10/game.png" alt="" width="738" height="553" /></a><br />
也许所有iOS程序员都有一个梦想，那就是做出排在app  store榜首的app，这种梦想也许就像是NBA球员对总冠军戒指的渴望一样。依托于强大的平台，几乎每款以前我参与制作的iOS产品，最终都能在  app store排行榜上登顶，从在gameloft时参与开发的spiderman for iphone到在腾讯时的斗地主 for  iphone/ipad，无不如此。当我自己开始组建新团队的时候，虽然也是奔着做榜首产品去的，只是我做梦也没有想到，这一刻会来的这么快，疯狂猎鸟是 我们团队组建以来的第一款游戏，而我们团队从组建到现在还不到3个月，至今，不是看着上面的截图，都会觉得这个现实太过梦幻。</p>
<p>每一款产品背后都有很多不为人知的故事，而每一款成功的产品背后，故事却往往不如人们想象的光鲜靓丽。我很想记录下疯狂猎鸟的诞生过程，以期这段历 史不会  被移动市场的波澜壮阔而埋没，因为疯狂猎鸟诞生的过程，也是移动大潮中一朵异常精彩的浪花。但是……我会觉得已经不能像以前那样可以完全放肆的自述己见，   因为，当我从事的工作慢慢从与技术打交道到与人打交道的时候，在总结中，我需要描述的是一个团队，甚至一个公司管理上的得与失，而不再是自己一个人技术上   那些天马行空的想法，并且，写下来后，我还得考虑每个当事人的心里感受了。其中牵涉的人与事太多，怕因为自己处理不了这种复杂度，有可能伤害了其他人的感  情，有可能写着像自我陶醉似的拔高自己，还有可能需要矫揉造作的去写些无关痛痒的客套话～～～可能类似的故事，只适合写小说，而不是当事人的回忆录吧。</p>
<p>也许，未来的某一天，这些故事尘封已久，大家都已经不会再在意的时候，我再来把这段值得铭记的故事写下来吧。</p>
<p>也许，当我开始有这样感觉的时候，我已经慢慢脱离了一个纯粹程序员的角色…..</p>
<p>再也许，我的下一篇总结，不能再以小小游戏程序员的工作总结来命名了，因为那样读者进来看到的会是文不对题的内容，然后咒骂我是标题党了。</p>
<p>以下还是不按照时间顺序事无巨细的描述了，还是想到哪写到哪吧。</p>
<h2>团队组建</h2>
<p>我的全部工作便是选择适当的人”– 韦尔奇</p>
<p>我是一个人从原公司唯一的团队中出来的，在团队组建之初只有我一个人加美术  zhaoruny（那时候他还刚刚进公司），可以算是从零开始，虽然那时候公司名义上也算是两个团队了，但是实际上我们团队完全就没法算一个团队，于是组   建一个较为完整的团队就是我最重要的任务了。而很显然的事实时，作为创业公司，招聘远没有一个名声在外的成熟大公司那么容易。（想想那一个手势就知道了）</p>
<p>这段时间我联系了一些非常优秀的人，但是因为各种原因，他们最终没有选择加入我们团队，这其中，最大的原因就是地理因素和家庭因素，还有两者的结合，比如父母或者女朋友不希望他到北京，离家/她太远，而是希望留在身边。</p>
<p>对于他们我个人是非常的遗憾，他们是非常优秀的年轻人，有着不可估量的发展潜力，但是因为家庭/女朋友的原因，放弃了真正的发展机会（我一直和他们 说，即  使你觉得我们公司不好，也应该来北京或者去上海，因为只有这里才有你们的用武之地）最后无奈的选择了在一个小城市工作。遗憾归遗憾吧，虽然从技术方面看我   觉得他们要能来我们公司对公司的发展非常的有帮助，但是那种担心受怕，连一点险都不愿意冒并且还受父母/女朋友控制的人，也许其实从性格上来说并不一定适  合我们创业团队吧。的确，当一个成年的男子汉，不能顶天立地则罢了，还会说自己在哪工作不由自己决定，这个实在是让我无法接受……</p>
<p>我从来都知道北京的生活压力大，但是也一直认为动力就来自于压力，在没有压力的环境下，人容易变得懒散（其实我就是一个非常懒散的人，但是来北京后 被人称  为学习工作过于自虐），而年轻的时候不奋斗，难道真的想去印证“少壮不努力，一生在内地;年少不拼搏，老死在中国；英语学不牢，世代在天朝；学习不刻苦，  永远在大陆”这句话吗？</p>
<p>对此，我送他们一首诗，多看看这首诗，趁还有年轻热血的时候想想，是要选择就此老死在家乡，还是去远方建功立业。</p>
<p>男儿立志出乡关，</p>
<p>学不成名死不还。</p>
<p>埋骨何须桑梓地，</p>
<p>人生无处不青山。</p>
<p>——西乡隆盛诗</p>
<p>虽然远方也不一定是美好的，风险也是存在的，但是我还是坚定的认为，用自己的时间和努力来换取人生的另外一种可能是完全值得的，人的一生要有一次为自己的梦想而竭尽全力！</p>
<p>勇敢不是不害怕，而是害怕的时候你还去坚持做！” — 尼克胡哲</p>
<p>总有人有技术也有理想抱负，同时还有实行之的勇气。yuchenl和longfeiw先后从各地来到北京，加入了我们团队，并且最终开发完成了疯狂猎鸟。而我觉得，我来公司最大的贡献便是招募了他们加入了公司，这个贡献比做疯狂猎鸟还要大。</p>
<h2>团队培养</h2>
<p>在你成为领导前，成功的标志就是自己成长；而当你成为领导之后，成功的标志就是如何使别人成长。– 韦尔奇</p>
<p>我一直以这句话来界定自己是否成功。做一个产品不算什么，培养一个能一直出优秀产品的团队，那才是我的目标。</p>
<p>yuchenl和longfeiw出于对于我的信任，能加入我的团队，我倍感荣幸，其实也同样肩负着压力，每时每刻无不如履薄冰，怕自己的经验不足或者处事方法有误会辜负了他们的期望。</p>
<div>其实，在团队培养中我的全部经验就是重道，而不是术。只要有真正想培养团队每一个人的心态，总是能想到好的方法，为大家的成长提供帮助。</div>
<div>中间做了很多按自己想法来的事情，后来感觉其实效果挺好，(起码暂时每个人都是这么说的）在这里也总结一下：</div>
<div>1.依据自己对每人的感觉，给他们分配合适的工作和提出合适的学习建议，最好的学习是来自于工作的。</div>
<div>2.结合每人自己的学习目标，职业目标，同时努力的提供指导，帮助他们实现目标。</div>
<div>以上两点需要有所结合，全都靠自己感觉，容易让团队成员走上自己不喜欢的发展方向，但是，假如作为技术leader不思考，全靠团队成员自己把握他们自己的方向，那又没有发挥自己应有的作用。</div>
<h2>团队激励</h2>
<p>如果你不能激励他人，你就不可能成为一名出色的领导者  – 韦尔奇</p>
<p>怎么样团队的工作效率才能高呢？能够完全肯定的是，不是给每名团队成员指定一名监工工作效率就高了。</p>
<p>我仍然认为这一点上道比术重要，重要的是真正的满足每个人的真正需求，让每个人都能开心的工作。其中，有意义和开心的工作，对于技术人员来说，还与 能否得  到成长有很大的关系。要是没有这种心态，而是想着怎么样最大的榨取员工，再采取多一倍的方法，也总归是无济于事，类似的方法只能是杀鸡取卵似的尽一时之  快。</p>
<div>
<p>假如是大公司，铁打的营盘，流水的兵，有开的起的工资，有时间耗着培训，有名声在外的招牌，不愁走了一个没有人来，只感叹中国人之多，不知真的人才之少，  而对于创业型公司来说，这个问题就更加需要引起重视了，因为愿意来公司的每一个人，都是公司的宝贵财富，都可能是公司可遇而不可求的。</p>
</div>
<p>对于这个问题，我不知道有哪些正确激励团队的方法，在微博上有人提出过，激励团队的最佳手段有三个：</p>
<p>1，加工资 2，加工资 3，加工资</p>
<p>这种方法实在不能算是高明，就算是最牛的工资也不是光靠这个来激励团队的，我个人有一些看法：</p>
<p>1.工作的有意义。</p>
<p>2.开心工作的氛围。</p>
<p>3.团队关系融洽</p>
<p>就猎鸟项目来说，对于参与疯狂猎鸟项目中的每一个人来说，疯狂猎鸟能在app  store排到榜首这成绩本身就让我们的工作显得有特别的意义。开心工作的氛围我只能说限于目前公司和我的条件，我暂时还是只能尽量的去维持，最起码团队  内部还不是一个不开心工作的氛围。而团队关系的融洽，因为大家的价值观很类似，所以还算不错。</p>
<h2>合理计划</h2>
<p>项目计划的错误是导致项目延期的主要原因，对项目的影响比其他原因加起来还要多。 — 《人月神话》</p>
<p>疯狂猎鸟不仅是团队组建以来的第一项目，事实也是我做主程的第一个项目，对项目的计划真是过于乐观了，难怪Brooks会在《人月神话》中说程序员是最乐观的群体了。</p>
<p>项目最开始是留出了1个半月左右的时间来开发，后来我初略的感觉了一下，第一次的计划是在一个月内就完成（包括测试），后半个月留作缓冲（因为还没 有拿到  策划文档，留半个月去做未知的新的需求），最后的结果是项目接近两个月才完成，按我的原计划来说，项目延期了100%……这真是太过于乐观的计划了！</p>
<p>事实上，我定计划的时候，还没有拿到游戏的策划文档，完全按照捕鱼的功能开发去计算工作量，并且按我个人能够较为有时间参与开发的速度去计算的，而 实际的  开发过程比与我想象的相差甚多，一方面游戏开发的实际内容比捕鱼复杂了太多，另一方面，因为下面要讲到的各个因素，我其实只参与了前期的设计和鸟出现轨迹  部分的开发。一来一去，整体项目的进度极大的延误。</p>
<h2>需求控制</h2>
<p>“做CEO最主要的工作是Kill ideas,提十个想法,九个我都会说N0” – 李彦宏</p>
<p>这个问题在很多公司都是个问题。老板不是只需要干两件事，一提需求，二催进度。  为什么乔布斯能够成为传奇，库克说：“乔布斯在位时他做的重要工作之一是否决大家想出的绝大部分创意，而使公司集中力量专注于其中两三个创意并将之变成现  实。”我觉得这个放在一个项目中也是合适的，一个项目中哪些需求是合适的，哪些需求是不合适的，这个实在是项目开发中最重要的工作，简而言之，我认为，<strong>一个能控制需求的人比一个提需求的人作用还要大。</strong></p>
<p>在这个项目中，很遗憾的是老板没有能成为那个控制需求的人，很幸运的是，老板让我部分的承担了控制需求的工作（虽然也有一些没有能控制的需求），在经历了这个项目后，虽然<strong>我非常确定项目最需要被控制的的有两点，一是过于远大的理想目标，二是不具体的需求。</strong>但   是其实到最后，我自己也不确定，“只要精品”的需求对项目带来的延期到底值不值得。因为这四个字，让美术来回的换了不知道多少次资源，对项目延期的直接影   响就在一周以上。而新添的宠物养成，宠物馆，到底算不算是游戏的亮点，对我们游戏能够登顶中国总榜，到底有没有帮助。不过，几乎可以肯定的是，要是我没有  在中途坚持过自己对控制需求，先出产品的想法，那么到现在，项目还在开发过程中……</p>
<h2>总结</h2>
<p>作为一个团队的管理，重要的是团队建设，团队培养，团队激励，对于一个项目的管理，重要的是合理的计划和需求的控制，回头一看，整篇总结，没有一个具体的技术问题，对于我来说，真是篇珍稀的博文啊。</p>
<p>上面提到了很多我的观点，但是却没有为每一项提供具体的可执行的解决方案，没有经历过的人容易觉得都是泛泛而谈，太过空洞，其实是因为我的经验还不 是那么多，不能很有信心的将一些我的方法告诉大家，但是总的来说，把上面的东西全部浓缩为一句话，那就是对于对于一个项目，有好的团队，合理的计划并且控 制住需求，项目没有做不好的。</p>
<p dir="ltr"><strong>write by 九天雁翎(JTianLing) — www.jtianling.com</strong></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="如何在PHP网站开发中，指定任意文件扩展名使用PHP解析" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F16.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F746.html">
                        <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/05/04/7493183.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">如何在PHP网站开发中，指定任意文件扩展名使用PHP解析</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="大型网站架构心得体会" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F4.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F746.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/09/03/27590691.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">大型网站架构心得体会</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="session和cookie原理及使用小结" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F93.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F746.html">
                        <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/05/04/7492795.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;">session和cookie原理及使用小结</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="剖析各大网站常用CSS图片技术—-CSS sprites" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F172.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F746.html">
                        <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/05/04/7492609.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;">剖析各大网站常用CSS图片技术—-CSS sprites</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="Session与cookie  原理及使用小结 (2)" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F97.html&from=http%3A%2F%2Fwww.liangkun.net%2Farchives%2F746.html">
                        <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;">Session与cookie  原理及使用小结 (2)</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><h2  class="related_post_title">随机推荐文章</h2><ul class="related_post"><li><a href="http://www.liangkun.net/archives/22.html" title="距高梁生日还有三天时间了，呼呼~万岁万万岁">距高梁生日还有三天时间了，呼呼~万岁万万岁</a></li><li><a href="http://www.liangkun.net/archives/738.html" title="WordPress高亮代码插件WP-CodeBox">WordPress高亮代码插件WP-CodeBox</a></li><li><a href="http://www.liangkun.net/archives/681.html" title="32位 与 64 位的区别 php">32位 与 64 位的区别 php</a></li><li><a href="http://www.liangkun.net/archives/383.html" title="回车(\r),  换行(\n),  回车换行(\r\n)区别以及它们各自是怎么出现的">回车(\r),  换行(\n),  回车换行(\r\n)区别以及它们各自是怎么出现的</a></li><li><a href="http://www.liangkun.net/archives/483.html" title="Discuz7.0程序二次开发必备：目录详解">Discuz7.0程序二次开发必备：目录详解</a></li><li><a href="http://www.liangkun.net/archives/457.html" title="金山张宴谈架构">金山张宴谈架构</a></li><li><a href="http://www.liangkun.net/archives/207.html" title="linux 下 tar 压缩和解压命令">linux 下 tar 压缩和解压命令</a></li><li><a href="http://www.liangkun.net/archives/429.html" title="[MySQL] 主键和外键的设计原则">[MySQL] 主键和外键的设计原则</a></li><li><a href="http://www.liangkun.net/archives/562.html" title="Discuz!论坛防灌水和垃圾贴有效过滤之TOP10">Discuz!论坛防灌水和垃圾贴有效过滤之TOP10</a></li><li><a href="http://www.liangkun.net/archives/87.html" title="今天百度，谷歌一系列网站都变黑白了？">今天百度，谷歌一系列网站都变黑白了？</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.liangkun.net/archives/746.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

