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

<channel>
	<title>奋斗足迹&#124;崔玉松 &#187; ZF</title>
	<atom:link href="http://fendou.org/tag/zf/feed/" rel="self" type="application/rss+xml" />
	<link>http://fendou.org</link>
	<description>为家人，为自己，为生活~~</description>
	<lastBuildDate>Fri, 24 Feb 2012 15:21:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Zend Framework学习笔记（二）</title>
		<link>http://fendou.org/2009/03/26/zend-framework-study-two/</link>
		<comments>http://fendou.org/2009/03/26/zend-framework-study-two/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 14:00:09 +0000</pubDate>
		<dc:creator>崔玉松</dc:creator>
				<category><![CDATA[Study & Reading]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[ZF]]></category>

		<guid isPermaLink="false">http://fendou.org/?p=338</guid>
		<description><![CDATA[很多天没再研究Zend Framework了，趁着还有些闲时间，再次研究一下，Zend Framework学习笔记（一）中大概了解了一下Zend Framework的代码接口分布，《Zend Framework in Action》一书中给出的标准文件夹结构如下图： 个人觉得这个结构只适合很小的项目或者不太复杂的项目，因为zend Library是包含在项目里面与web_root同一级，假如我需要创建一个helloword_2的项目，那么不得不再复制一个同样的文件夹结构，Zend Library将会有两份，如果有十几个或者更多的这样的工程，那么Library将会有很多，Zend Framework是个很活跃的框架，没准哪天就升级了好几个版本，如果你需要升级或者打补丁，那么就会烦死。 当然在application下新建一个modules文件夹，将各个功能放在这里也是一个方法，但是你肯定不想一堆一点关联都没有的项目堆在一起，比如豆瓣的九点和群组，这两个几乎没有任何关联，当然实际应用中还有一个非常重要的用户模块。每个应用只做自己该做的事情，才会最大限度的独立很分散，无论是为了负载均衡进行多点发布还是代码维护都非常有用。而且所有的应用都通过一个入口（web_root中的index.php）和同一个分配器来处理，显然并发能力和容错能力都会下降，稍微有点差错，所有的应用都挂了。入口，分配器等属于全局的东西会影响所有应用，事实上可能很多东西对别的应用毫无用处，但是又有很多应用又需要，这时候就产生了浪费。 不过Zend Framework是个自由度很高的框架，可以自己定义一些东西，让Library从项目中独立出来，与项目目录平级，每个项目拥有自己的独立名称、web_root、入口和分配器，这样做可以为每个项目单独添加Vhost，升级内核（zend Library）也只要升级一个即可，有更高的自由度和松散度。所以我推荐如下的结构： 图中的test是一个项目名，请注意是项目名，不是功能名称，在application中你可以为这个项目建立很多modules，我在图中没有建立这样的文件夹，你可以建立test2，test3……项目，这些项目毫不相关，或者关联度很低，比如用户就得是一个独立的项目，其他的功能可能是一个或者几个独立的项目，事实上还有更好的目录结构，我是从神仙那里学过来的.在controllers文件夹中建立front， backend， amdin，三个文件夹，在view中也建立对应的文件夹，放在front中的内容不做任何限制，backend中需要登录，admin就不用说了，渲染views中对应文件夹的模板，全局进行权限控制，似乎神仙这样的结构不能提供精细访问权限，zend Framework提供了这样的精细权限控制。 如果你的代码要改成左图的结构，需要改动一些代码，首先是需要在入口文件中注册这些目录的位置代码如下： define&#40;'APP_PATH', dirname&#40; dirname &#40; __FILE__ &#41; &#41; &#41;; define&#40;'LIB_PATH', dirname&#40; APP_PATH &#41; . &#34;/library&#34;&#41;; date_default_timezone_set&#40;'Asia/Shanghai'&#41;; //directory setup and class loading set_include_path&#40;'.' . PATH_SEPARATOR . LIB_PATH . PATH_SEPARATOR . APP_PATH . '/application/models' . PATH_SEPARATOR . get_include_path&#40;&#41;&#41;;...  <a href="http://fendou.org/2009/03/26/zend-framework-study-two/" class="more-link" title="Read Zend Framework学习笔记（二）">Read more &#187;</a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2009%2F03%2F09%2Fzend-framework-study-one%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F03%2F26%2Fzend-framework-study-two%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Zend Framework学习笔记（一）</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F03%2F07%2Fphp%25E4%25BB%258E%25E4%25B8%259A%25E8%2580%2585%25E7%2589%25B9%25E5%25BE%2581%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F03%2F26%2Fzend-framework-study-two%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php从业者特征</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F30%2Fwhy-php-hacks%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F03%2F26%2Fzend-framework-study-two%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Why PHP Hacks?</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2009%2F04%2F12%2Fphp-study-ppt%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F03%2F26%2Fzend-framework-study-two%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于PHP最佳实践方法的两个PPT</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F02%2F%25E5%2588%259D%25E5%25AD%25A6php%25E7%259A%258418%25E4%25B8%25AA%25E5%259F%25BA%25E7%25A1%2580%25E4%25BE%258B%25E7%25A8%258B%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F03%2F26%2Fzend-framework-study-two%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">初学PHP的18个基础例程</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>很多天没再研究Zend Framework了，趁着还有些闲时间，再次研究一下，<a href="http://fendou.org/2009/03/09/zend-framework-study-one/" target="_blank">Zend Framework学习笔记（一）</a>中大概了解了一下Zend Framework的代码接口分布，《Zend Framework in Action》一书中给出的标准文件夹结构如下图：</p>
<img class="alignleft" src="http://muxi.appspot.com/blog/upload/agRtdXhpchELEgpVcGxvYWRGaWxlGJ0IDA.png" alt="文件夹结构" width="341" height="437" />
<p>个人觉得这个结构只适合很小的项目或者不太复杂的项目，因为zend Library是包含在项目里面与web_root同一级，假如我需要创建一个helloword_2的项目，那么不得不再复制一个同样的文件夹结构，Zend Library将会有两份，如果有十几个或者更多的这样的工程，那么Library将会有很多，Zend Framework是个很活跃的框架，没准哪天就升级了好几个版本，如果你需要升级或者打补丁，那么就会烦死。</p>
<p>当然在application下新建一个modules文件夹，将各个功能放在这里也是一个方法，但是你肯定不想一堆一点关联都没有的项目堆在一起，比如豆瓣的九点和群组，这两个几乎没有任何关联，当然实际应用中还有一个非常重要的用户模块。每个应用只做自己该做的事情，才会最大限度的独立很分散，无论是为了负载均衡进行多点发布还是代码维护都非常有用。而且所有的应用都通过一个入口（web_root中的index.php）和同一个分配器来处理，显然并发能力和容错能力都会下降，稍微有点差错，所有的应用都挂了。入口，分配器等属于全局的东西会影响所有应用，事实上可能很多东西对别的应用毫无用处，但是又有很多应用又需要，这时候就产生了浪费。</p>
<p>不过Zend Framework是个自由度很高的框架，可以自己定义一些东西，让Library从项目中独立出来，与项目目录平级，每个项目拥有自己的独立名称、web_root、入口和分配器，这样做可以为每个项目单独添加Vhost，升级内核（zend Library）也只要升级一个即可，有更高的自由度和松散度。所以我推荐如下的结构：</p>
<img class="alignleft" title="推荐结构" src="http://muxi.appspot.com/blog/upload/agRtdXhpchALEgpVcGxvYWRGaWxlGC8M.png" alt="推荐结构" width="173" height="258" />
<p>图中的test是一个项目名，请注意是项目名，不是功能名称，在application中你可以为这个项目建立很多modules，我在图中没有建立这样的文件夹，你可以建立test2，test3……项目，这些项目毫不相关，或者关联度很低，比如用户就得是一个独立的项目，其他的功能可能是一个或者几个独立的项目，事实上还有更好的目录结构，我是从<a href="http://syre.blogbus.com" target="_blank">神仙</a>那里学过来的.在controllers文件夹中建立front， backend， amdin，三个文件夹，在view中也建立对应的文件夹，放在front中的内容不做任何限制，backend中需要登录，admin就不用说了，渲染views中对应文件夹的模板，全局进行权限控制，似乎<a href="http://syre.blogbus.com" target="_blank">神仙</a>这样的结构不能提供精细访问权限，zend Framework提供了这样的精细权限控制。</p>
<p>如果你的代码要改成左图的结构，需要改动一些代码，首先是需要在入口文件中注册这些目录的位置代码如下：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">       <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'APP_PATH'</span><span style="color: #339933;">,</span> <span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">dirname</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900; font-weight: bold;">__FILE__</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'LIB_PATH'</span><span style="color: #339933;">,</span> <span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span> APP_PATH <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/library&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">date_default_timezone_set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Asia/Shanghai'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">//directory setup and class loading</span>
	<span style="color: #990000;">set_include_path</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'.'</span> <span style="color: #339933;">.</span> PATH_SEPARATOR <span style="color: #339933;">.</span> LIB_PATH
				<span style="color: #339933;">.</span> PATH_SEPARATOR <span style="color: #339933;">.</span> APP_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/application/models'</span>
				<span style="color: #339933;">.</span> PATH_SEPARATOR <span style="color: #339933;">.</span> <span style="color: #990000;">get_include_path</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">include</span>  <span style="color: #0000ff;">&quot;Zend/Loader.php&quot;</span><span style="color: #339933;">;</span>
	Zend_Loader<span style="color: #339933;">::</span><span style="color: #004000;">registerAutoload</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">//set up controller</span>
	<span style="color: #000088;">$frontController</span> <span style="color: #339933;">=</span> Zend_Controller_Front<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$frontController</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">throwExceptions</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$frontController</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setControllerDirectory</span><span style="color: #009900;">&#40;</span> APP_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/application/controllers'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	Zend_layout<span style="color: #339933;">::</span><span style="color: #004000;">startMvc</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'layoutPath'</span><span style="color: #339933;">=&gt;;</span> APP_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/application/layouts'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">//run</span>
	<span style="color: #000088;">$frontController</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">dispatch</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>这么一堆代码中其实最主要的就是最开始两句，获取当前项目的磁盘路径和Library，然后告诉程序，在你的action文件你需要一个在渲染模板前告诉程序去哪里取得相应的模板文件，默认是在View/script/中，zend Framework在渲染模板前提供一个抽象方法 postDispatch，可以override之：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">function</span> postDispatch<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
       <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addScriptPath</span><span style="color: #009900;">&#40;</span>APP_PATH<span style="color: #339933;">.</span> <span style="color: #0000ff;">'/application/views/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span></pre></div></div>

<p>需要改变的代码就这么两处，实际上还可以做得更好点，将这个postDispatch写入helper中，这样就不需要在每个action文件中重复这段代码了</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2009%2F03%2F09%2Fzend-framework-study-one%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F03%2F26%2Fzend-framework-study-two%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Zend Framework学习笔记（一）</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F03%2F07%2Fphp%25E4%25BB%258E%25E4%25B8%259A%25E8%2580%2585%25E7%2589%25B9%25E5%25BE%2581%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F03%2F26%2Fzend-framework-study-two%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php从业者特征</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F30%2Fwhy-php-hacks%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F03%2F26%2Fzend-framework-study-two%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Why PHP Hacks?</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2009%2F04%2F12%2Fphp-study-ppt%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F03%2F26%2Fzend-framework-study-two%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于PHP最佳实践方法的两个PPT</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F02%2F%25E5%2588%259D%25E5%25AD%25A6php%25E7%259A%258418%25E4%25B8%25AA%25E5%259F%25BA%25E7%25A1%2580%25E4%25BE%258B%25E7%25A8%258B%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F03%2F26%2Fzend-framework-study-two%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">初学PHP的18个基础例程</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://fendou.org/2009/03/26/zend-framework-study-two/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Zend Framework学习笔记（一）</title>
		<link>http://fendou.org/2009/03/09/zend-framework-study-one/</link>
		<comments>http://fendou.org/2009/03/09/zend-framework-study-one/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 14:50:34 +0000</pubDate>
		<dc:creator>崔玉松</dc:creator>
				<category><![CDATA[Study & Reading]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[ZF]]></category>

		<guid isPermaLink="false">http://fendou.org/?p=319</guid>
		<description><![CDATA[1、请求  ，Zend_Controller_Request_Http 类提供了整个的HTTP访问需要的环境。 2、路由  ，路由特性是由 Zend_Controller_Router_Interface实现的，由Zend_Controller_Router_Rewrite提供URL重写功能。 3、分配器 ，Zend_Controller_Dispatch_Standard类控制 4、Actiong ，所有的动作都是源自于Zend_Controller_Action这个抽象类，Zend_Controller_Action提供了两个级别的处理请求，一个是init(),另外一个是preDispatch() init()函数是在控制器被调用的时候触发的  ，如果该控制器被调用多次，那么preDispatch（）将被调用多次，而init（）只调用一次。 5、Response（响应） Zend_Controller_Response_Http 是为编写web程序准备的 Zend_Controller_Response_CLI适应更多的场合 Zend_Controller_Response_Http包含三种信息：header，body和exception（异常） 6、Front Controller Plug-ins（前端控制器插件） 所有的插件都实现于Zend_Controller_Plugin_Abstract这个抽象类，一共有六个事件方法可以被重写。 1)routeStartup() 2)dispatchLoopStartup() 3)preDispatch () 4)postDispatch() 5)dispatchLoopShutDown() 6)routeShutDown()<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2009%2F03%2F26%2Fzend-framework-study-two%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F03%2F09%2Fzend-framework-study-one%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Zend Framework学习笔记（二）</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F03%2F07%2Fphp%25E4%25BB%258E%25E4%25B8%259A%25E8%2580%2585%25E7%2589%25B9%25E5%25BE%2581%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F03%2F09%2Fzend-framework-study-one%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php从业者特征</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F02%2F%25E7%25AE%2580%25E5%258D%2595%25E6%2598%2593%25E5%25AD%25A6%25E7%259A%2584php%25E5%2585%25A5%25E9%2597%25A8%25E6%2595%2599%25E7%25A8%258B%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F03%2F09%2Fzend-framework-study-one%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">简单易学的PHP入门教程</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F07%2F10%2Fphp%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F03%2F09%2Fzend-framework-study-one%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP记事本程序（三）----持续改进</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F08%2Fphp%25E8%25A7%25A3%25E6%259E%2590xml%25E6%2596%2587%25E6%25A1%25A3%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F03%2F09%2Fzend-framework-study-one%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP解析XML文档</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>1、请求  ，Zend_Controller_Request_Http 类提供了整个的HTTP访问需要的环境。</p>
<p>2、路由  ，路由特性是由 Zend_Controller_Router_Interface实现的，由Zend_Controller_Router_Rewrite提供URL重写功能。</p>
<p>3、分配器 ，Zend_Controller_Dispatch_Standard类控制</p>
<p>4、Actiong ，所有的动作都是源自于Zend_Controller_Action这个抽象类，Zend_Controller_Action提供了两个级别的处理请求，一个是init(),另外一个是preDispatch()</p>
<p>init()函数是在控制器被调用的时候触发的  ，如果该控制器被调用多次，那么preDispatch（）将被调用多次，而init（）只调用一次。</p>
<p>5、Response（响应）</p>
<p>Zend_Controller_Response_Http 是为编写web程序准备的</p>
<p>Zend_Controller_Response_CLI适应更多的场合</p>
<p>Zend_Controller_Response_Http包含三种信息：header，body和exception（异常）</p>
<p>6、Front Controller Plug-ins（前端控制器插件）</p>
<p>所有的插件都实现于Zend_Controller_Plugin_Abstract这个抽象类，一共有六个事件方法可以被重写。</p>
<p>1)routeStartup()</p>
<p>2)dispatchLoopStartup()</p>
<p>3)preDispatch ()</p>
<p>4)postDispatch()</p>
<p>5)dispatchLoopShutDown()</p>
<p>6)routeShutDown()</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2009%2F03%2F26%2Fzend-framework-study-two%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F03%2F09%2Fzend-framework-study-one%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Zend Framework学习笔记（二）</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F03%2F07%2Fphp%25E4%25BB%258E%25E4%25B8%259A%25E8%2580%2585%25E7%2589%25B9%25E5%25BE%2581%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F03%2F09%2Fzend-framework-study-one%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">php从业者特征</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F02%2F%25E7%25AE%2580%25E5%258D%2595%25E6%2598%2593%25E5%25AD%25A6%25E7%259A%2584php%25E5%2585%25A5%25E9%2597%25A8%25E6%2595%2599%25E7%25A8%258B%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F03%2F09%2Fzend-framework-study-one%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">简单易学的PHP入门教程</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2008%2F07%2F10%2Fphp%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F03%2F09%2Fzend-framework-study-one%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP记事本程序（三）----持续改进</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Ffendou.org%2F2007%2F11%2F08%2Fphp%25E8%25A7%25A3%25E6%259E%2590xml%25E6%2596%2587%25E6%25A1%25A3%2F&from=http%3A%2F%2Ffendou.org%2F2009%2F03%2F09%2Fzend-framework-study-one%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP解析XML文档</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://fendou.org/2009/03/09/zend-framework-study-one/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

