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

<channel>
	<title>残酷の青春 &#187; PHP</title>
	<atom:link href="http://www.cruelyouth.com/subjects/tech/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cruelyouth.com</link>
	<description>journey continues</description>
	<lastBuildDate>Tue, 17 Jan 2012 06:53:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>MARS FRAMEWORK 备忘</title>
		<link>http://www.cruelyouth.com/2011/05/16/mars-framework-%e5%a4%87%e5%bf%98/</link>
		<comments>http://www.cruelyouth.com/2011/05/16/mars-framework-%e5%a4%87%e5%bf%98/#comments</comments>
		<pubDate>Mon, 16 May 2011 01:58:15 +0000</pubDate>
		<dc:creator>Mars</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[技术]]></category>

		<guid isPermaLink="false">http://www.cruelyouth.com/?p=411</guid>
		<description><![CDATA[路径结构 1234567891011121314151617# /configs&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 全局config路径 # /libs &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 全局库路径 # /locales&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<h2>路径结构</h2>
<div class="codecolorer-container php geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># /configs&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 全局config路径<br />
</span><span style="color: #666666; font-style: italic;"># /libs &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 全局库路径<br />
</span><span style="color: #666666; font-style: italic;"># /locales&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 全局locales路径<br />
</span><span style="color: #666666; font-style: italic;"># /modules&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 模块路径<br />
</span><span style="color: #666666; font-style: italic;"># /modules/index&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 默认模块，module=default<br />
</span><span style="color: #666666; font-style: italic;"># /modules/user1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 自定义模块，module=user1<br />
</span><span style="color: #666666; font-style: italic;"># /modules/user1/app1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 自定义模块(user1)下的app1，app=app1<br />
</span><span style="color: #666666; font-style: italic;"># /modules/user1/app1/controller&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 自定义模块(user1)下的app1，controller路径<br />
</span><span style="color: #666666; font-style: italic;"># /modules/user1/app1/controller/controller1.php&nbsp; &nbsp; 自定义模块(user1)下的app1的controller1<br />
</span><span style="color: #666666; font-style: italic;"># /modules/user1/app1/views &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 自定义模块（user1）的app1下的view路径<br />
</span><span style="color: #666666; font-style: italic;"># /modules/user1/app1/views/controler1&nbsp; &nbsp; &nbsp; 自定义模块（user1）下app1的controller=controller1的view路径<br />
</span><span style="color: #666666; font-style: italic;"># /modules/user1/configs&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 自定义模块(user1)的configs路径<br />
</span><span style="color: #666666; font-style: italic;"># /modules/user1/bootstrap.php&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 自定义模块(user1)的启动文件<br />
</span><span style="color: #666666; font-style: italic;"># /public &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document_root<br />
</span><span style="color: #666666; font-style: italic;"># /public/index.php &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 入口<br />
</span><span style="color: #666666; font-style: italic;"># /tests&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 测试程序<br />
</span><span style="color: #666666; font-style: italic;"># /bootstrap.php&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 全局启动路径</span></div></td></tr></tbody></table></div>
<h2>/public/.htaccess</h2>
<div class="codecolorer-container text geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">RewriteEngine On<br />
RewriteBase /<br />
RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteCond %{REQUEST_FILENAME} !-d<br />
RewriteRule . /index.php [L]</div></td></tr></tbody></table></div>
<h2>/public/index.php</h2>
<div class="codecolorer-container php geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">&lt;!--</span>?php <span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;../bootstrap.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$route</span> <span style="color: #339933;">=</span> Mars_Router<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;">$route</span><span style="color: #339933;">---&gt;</span><span style="color: #004000;">initialize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<h2>Mars_BaseController</h2>
<p>所有controller的基类，action响应用func_action(void)获取</p>
<p>4种渲染方法,通过$controller->frontend设置：</p>
<ol>
<li> HTML</li>
<li> JSON</li>
<li> TEXT(PLAINTEXT)</li>
<li> XML</li>
</ol>
<p><strong>HTML View(默认渲染方式)</strong><br />
<a href="http://www.cruelyouth.com/wp-content/uploads/2011/05/mars_controller_view_demo.png"><img class="alignnone size-full wp-image-420" title="mars_controller_view_demo" src="http://www.cruelyouth.com/wp-content/uploads/2011/05/mars_controller_view_demo.png" alt="" width="400" height="300" /></a></p>
<p>默认frame view使用/views/frame.phtml，默认view使用该模块/app/views/controller/action.phtml</p>
<p>如要使用特殊的frame view或view请用<br />
$controller->_frameView<br />
$controller->_view<br />
进行设置</p>
<p><strong>JSON View</strong><br />
相关变量$controller->return是返回数据，$controller->success标示是否成功<br />
如：</p>
<div class="codecolorer-container php geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">function</span> test_action<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">frontend</span> <span style="color: #339933;">=</span> Mars_FrontEnd<span style="color: #339933;">::</span><span style="color: #004000;">JSON</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #b1b100;">return</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">success</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>返回：</p>
<div class="codecolorer-container javascript geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">&quot;success&quot;</span><span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;data&quot;</span><span style="color: #339933;">:</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p><strong>TEXT View</strong></p>
<div class="codecolorer-container php geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">function</span> text_action<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">frontend</span> <span style="color: #339933;">=</span> Mars_FrontEnd<span style="color: #339933;">::</span><span style="color: #004000;">TEXT</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #b1b100;">return</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;hello world&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>返回</p>
<div class="codecolorer-container text geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">hello world</div></td></tr></tbody></table></div>
<p><strong>XML View</strong></p>
<div class="codecolorer-container php geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">function</span> xml_action<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">frontend</span> <span style="color: #339933;">=</span> Mars_FrontEnd<span style="color: #339933;">::</span><span style="color: #004000;">XML</span> <span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #b1b100;">return</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>返回：</p>
<div class="codecolorer-container xml geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;data<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;foobar<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/foobar<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;foobar<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/foobar<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;foobar<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>3<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/foobar<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/data<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></td></tr></tbody></table></div>
<p><strong>Mars_BaseController->cache</strong><br />
cache是符合memcache类的实例，将会存储output结果，在缓存存在时直接输出缓存<br />
cache_key由uri及$_GET中的参数组成，如$_GET中有__refresh参数则会刷新缓存，或controller中有一成员变量标示$action.&#8221;_refresh&#8221;=true/false可以强制不使用或使用缓存。</p>
<h2>Mars_EventManager 事件处理</h2>
<p>插入事件点（Event Point）,如：</p>
<div class="codecolorer-container objc geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="objc codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Mars_EventManager<span style="color: #002200;">::</span><span style="color: #a61390;">register</span><span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">&quot;ACTION_BEGIN&quot;</span>, new Mars_Event<span style="color: #002200;">&#40;</span>Mars_Event<span style="color: #002200;">::</span>ACTION_BEGIN, $this<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#41;</span>;</div></td></tr></tbody></table></div>
<p>在bootstrap.php中添加事件侦听</p>
<div class="codecolorer-container php geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Mars_EventManager<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;">-&gt;</span><span style="color: #004000;">addEventListener</span><span style="color: #009900;">&#40;</span>Mars_Event<span style="color: #339933;">::</span><span style="color: #004000;">BEGIN</span><span style="color: #339933;">,</span> callback_function<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>callback_function有一个参数，即Mars_Event</p>
<p>默认支持以下事件</p>
<div class="codecolorer-container php geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:auto;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># router begins<br />
</span>&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">const</span> BEGIN &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;BEGIN&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># router ends<br />
</span>&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">const</span> <a href="http://www.php.net/end"><span style="color: #990000;">END</span></a> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;END&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># controller class not found<br />
</span>&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">const</span> CLASS_NOT_FOUND &nbsp; <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;CLASS_NOT_FOUND&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># controller's action not found<br />
</span>&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">const</span> ACTION_NOT_FOUND &nbsp;<span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;ACTION_NOT_FOUND&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># controller's action begins<br />
</span>&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">const</span> ACTION_BEGIN&nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;ACTION_BEGIN&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># controller's action ends<br />
</span>&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">const</span> ACTION_END&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;ACTION_END&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># render view begins<br />
</span>&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">const</span> RENDER_BEGIN&nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;RENDER_BEGIN&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># render view ends<br />
</span>&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">const</span> RENDER_END&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;RENDER_END&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># launch begins<br />
</span>&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">const</span> LAUNCH_BEGIN&nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;LAUNCH_BEGIN&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># launch ends<br />
</span>&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">const</span> LAUNCH_END&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;LAUNCH_END&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># view output begin<br />
</span>&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">const</span> FILTER_OUTPUT &nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;FILTER_OUTPUT&quot;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<h2>前置和后置过滤器</h2>
<div class="codecolorer-container php geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">function</span> test_filter<span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span><span style="color: #339933;">,</span> <span style="color: #000088;">$t</span><span style="color: #339933;">,</span> <span style="color: #000088;">$in</span><span style="color: #339933;">,</span> <span style="color: #000088;">$out</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;A&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;BB&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$c</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
Mars_PostFilter<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;">-&gt;</span><span style="color: #004000;">register</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;test_filter&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> test_prefilter<span style="color: #009900;">&#40;</span><span style="color: #000088;">$param</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'xxxx'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$param</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
Mars_PreFilter<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;">-&gt;</span><span style="color: #004000;">register</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'function'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'test_prefilter'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'params'</span><span style="color: #339933;">=&gt;</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'a'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://www.cruelyouth.com/2011/05/16/mars-framework-%e5%a4%87%e5%bf%98/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>win7下安装zend studio 5.5</title>
		<link>http://www.cruelyouth.com/2010/05/17/win7%e4%b8%8b%e5%ae%89%e8%a3%85zend-studio-5-5/</link>
		<comments>http://www.cruelyouth.com/2010/05/17/win7%e4%b8%8b%e5%ae%89%e8%a3%85zend-studio-5-5/#comments</comments>
		<pubDate>Mon, 17 May 2010 07:10:05 +0000</pubDate>
		<dc:creator>Mars</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[技术]]></category>

		<guid isPermaLink="false">http://www.cruelyouth.com/?p=248</guid>
		<description><![CDATA[装了windows 7,发现普通模式不兼容zendstudio,又装了zendstudio 7,发现那个难用啊，晕死，下面是win7上安装 zendstudio 5.5的步骤 01、下载并安装最新版本的 JRE for Windows: http://java.com/en/download/manual.jsp 02、使用WINRAR解压 Zend Studio 5.5.1.exe 03、 进入解压后的文件夹 Zend Studio 5.5.1Windows(下面简称A文件夹) ，将resource目录下的jre文件夹重命名为jre.back(或其他名称都可) 04、复制 C:Program Files (x86)Javajre6到第三步中的目录，并将jre6重命名为jre 05、执行安装 A文件夹下的 Zend Studio 5.5.1.exe 06、安装完成后将 A文件夹 下 resource 目录中的jre.back文件夹复制到Zend Studio 的安装目录中， 07、重命名安装目录中的 jre 文件夹为 jre6 08、重命名安装目录中的 jre.back 文件夹为 jre 09、在ZendStudio图标上点击右键/属性/兼容性 设置兼容模式为 Vista 10、启动Zend Studio]]></description>
			<content:encoded><![CDATA[<p>装了windows 7,发现普通模式不兼容zendstudio,又装了zendstudio 7,发现那个难用啊，晕死，下面是win7上安装<br />
zendstudio 5.5的步骤</p>
<p>01、下载并安装最新版本的 JRE for Windows: http://java.com/en/download/manual.jsp</p>
<p>02、使用WINRAR解压 Zend Studio 5.5.1.exe</p>
<p>03、 进入解压后的文件夹 Zend Studio 5.5.1Windows(下面简称A文件夹) ，将resource目录下的jre文件夹重命名为jre.back(或其他名称都可)</p>
<p>04、复制 C:Program Files (x86)Javajre6到第三步中的目录，并将jre6重命名为jre</p>
<p>05、执行安装 A文件夹下的 Zend Studio 5.5.1.exe</p>
<p>06、安装完成后将 A文件夹 下 resource 目录中的jre.back文件夹复制到Zend Studio 的安装目录中，</p>
<p>07、重命名安装目录中的 jre 文件夹为 jre6</p>
<p>08、重命名安装目录中的 jre.back 文件夹为 jre</p>
<p>09、在ZendStudio图标上点击右键/属性/兼容性 设置兼容模式为 Vista</p>
<p>10、启动Zend Studio </p>
]]></content:encoded>
			<wfw:commentRss>http://www.cruelyouth.com/2010/05/17/win7%e4%b8%8b%e5%ae%89%e8%a3%85zend-studio-5-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

