<?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; AMFPHP</title>
	<atom:link href="http://www.5ga.cn/blog/archives/tag/amfphp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.5ga.cn/blog</link>
	<description>嘎嘎的博客</description>
	<lastBuildDate>Wed, 18 Jan 2012 05:35:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>AMFphp 的简介</title>
		<link>http://www.5ga.cn/blog/archives/2009/11/1832/</link>
		<comments>http://www.5ga.cn/blog/archives/2009/11/1832/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 05:48:36 +0000</pubDate>
		<dc:creator>嘎嘎</dc:creator>
				<category><![CDATA[FLASH]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[AMFPHP]]></category>

		<guid isPermaLink="false">http://www.5ga.cn/blog/?p=1832</guid>
		<description><![CDATA[　　AMFPHP实际上是一个提供了FLEX等类型的客户端和PHP服务器端程序的一个开源的，免费通讯机制，它可以使得FLEX等客户端和服务器的PHP程序之间基于数据结果的交换。flash里自己有个二进制的数据传输协议Amf， 幸好php里有个amfphp,那就很方便了， 协议会自动转换php和flash的数据类型，本来都是动态语言，啥都好办。 　　那为什么需要AMFPHP呢？ 　　事实上FLEX本身就提供和和服务器端交互的各种手段，比如HTTPSERVICE组件本来就可以轻易调用基于 PHP或者其他语言的服务器端程序来获得结果，但是很显然它是基于HTTP的文本协议，对于大量数据的交换显然不是非常高效，所以AMFPHP在设计的时候就考虑到这个问题，它通过使用二进制协议来提高通讯的效率，从而提高了在传输大量数据的时候的效率。 　　还有一个优点就是，AMFPHP会自动处理PHP端的数据类型到FLEX客户端的数据类型的匹配，从而降低了FLEX使用PHP服务端程序的成本。 　　那么，一般如何使用AMFPHP呢？ 　　最普通的用法是一般把AMFPHP部署在服务器端，它可以去数据库里去取得各种数据，然后返回给FLEX的DataGrid组件来展示，而对于FLEX客户端，在正确配置后只需要像调用FLEX本地方法一样来取得PHP服务器端程序返回的数据！ AMFPHP的官网：http://www.amfphp.org/ 另外要安装个可以提升性能的东东：http://www.teslacore.it/wiki/index.php?title=AMFEXT 将amfphp放到php项目目录下就可以使用了。 注意将Remote Service php 放到 amfphp\services 目录里面就可以使用了，很简单。 贴个session的例子： flash端： 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758// Wade Arnold: 1/6/2008 // Example is designed to show how to use PHP sessions. package &#123; &#160; &#160; // required for flash file and output display &#160; &#160; import flash.display.MovieClip; &#160; &#160; import fl.events.*; [...]]]></description>
			<content:encoded><![CDATA[<p>　　AMFPHP实际上是一个提供了FLEX等类型的客户端和PHP服务器端程序的一个开源的，免费通讯机制，它可以使得FLEX等客户端和服务器的PHP程序之间基于数据结果的交换。flash里自己有个二进制的数据传输协议Amf， 幸好php里有个amfphp,那就很方便了， 协议会自动转换php和flash的数据类型，本来都是动态语言，啥都好办。<span id="more-1832"></span></p>
<p>　　那为什么需要AMFPHP呢？</p>
<p>　　事实上FLEX本身就提供和和服务器端交互的各种手段，比如HTTPSERVICE组件本来就可以轻易调用基于 PHP或者其他语言的服务器端程序来获得结果，但是很显然它是基于HTTP的文本协议，对于大量数据的交换显然不是非常高效，所以AMFPHP在设计的时候就考虑到这个问题，它通过使用二进制协议来提高通讯的效率，从而提高了在传输大量数据的时候的效率。</p>
<p>　　还有一个优点就是，AMFPHP会自动处理PHP端的数据类型到FLEX客户端的数据类型的匹配，从而降低了FLEX使用PHP服务端程序的成本。</p>
<p>　　那么，一般如何使用AMFPHP呢？</p>
<p>　　最普通的用法是一般把AMFPHP部署在服务器端，它可以去数据库里去取得各种数据，然后返回给FLEX的DataGrid组件来展示，而对于FLEX客户端，在正确配置后只需要像调用FLEX本地方法一样来取得PHP服务器端程序返回的数据！</p>
<p>AMFPHP的官网：<a href="http://www.amfphp.org/" target="_blank"><strong>http://www.amfphp.org/</strong></a></p>
<p>另外要安装个可以提升性能的东东：<a href="http://www.teslacore.it/wiki/index.php?title=AMFEXT" target="_blank">http://www.teslacore.it/wiki/index.php?title=AMFEXT</a><br />
将amfphp放到php项目目录下就可以使用了。<br />
注意将Remote Service php 放到 amfphp\services 目录里面就可以使用了，很简单。</p>
<p>贴个session的例子：<br />
flash端：</p>
<div class="codecolorer-container actionscript3 mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:700px;"><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 />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900; font-style: italic;">// Wade Arnold: 1/6/2008</span><br />
<span style="color: #009900; font-style: italic;">// Example is designed to show how to use PHP sessions.</span><br />
<span style="color: #9900cc; font-weight: bold;">package</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// required for flash file and output display</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MovieClip</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> fl<span style="color: #000066; font-weight: bold;">.</span>events<span style="color: #000066; font-weight: bold;">.*;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.*;</span><br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// required to send/recieve data over AMF</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.net</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">NetConnection</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.net</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">Responder</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Flash CS3 Document Class.</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Counter <span style="color: #0033ff; font-weight: bold;">extends</span> <span style="color: #004993;">MovieClip</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> gateway<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;http://localhost/server/amfphp/gateway.php&quot;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> connection<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">NetConnection</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> responder<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Responder</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Counter<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;AMFPHP Session Counter Example&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Event listner for buttons</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; increment_btn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CLICK</span><span style="color: #000066; font-weight: bold;">,</span> incrementCounter<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; reset_btn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CLICK</span><span style="color: #000066; font-weight: bold;">,</span> resetCounter<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; destroy_btn<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CLICK</span><span style="color: #000066; font-weight: bold;">,</span> destroySession<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Responder to handle data returned from AMFPHP.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; responder = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Responder</span><span style="color: #000000;">&#40;</span>onResult<span style="color: #000066; font-weight: bold;">,</span> onFault<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; connection = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">NetConnection</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Gateway.php url for NetConnection</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; connection<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">connect</span><span style="color: #000000;">&#40;</span>gateway<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Method run when the &quot;Increment Counter&quot; button is clicked.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> incrementCounter<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Send the data to the remote server.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; connection<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">call</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Counter.increment&quot;</span><span style="color: #000066; font-weight: bold;">,</span> responder<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Method run when the &quot;Rest Counter&quot; button is clicked.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> resetCounter<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Send the data to the remote server.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; connection<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">call</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Counter.unregister&quot;</span><span style="color: #000066; font-weight: bold;">,</span> responder<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Method run when the &quot;Destroy Session&quot; button is clicked.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> destroySession<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Send the data to the remote server.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; connection<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">call</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Counter.destroy&quot;</span><span style="color: #000066; font-weight: bold;">,</span> responder<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Handle a successful AMF call. This method is defined by the responder.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onResult<span style="color: #000000;">&#40;</span>result<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Object</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; response_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #004993;">String</span><span style="color: #000000;">&#40;</span>result<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Handle an unsuccessfull AMF call. This is method is dedined by the responder.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onFault<span style="color: #000000;">&#40;</span>fault<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Object</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; response_txt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #004993;">String</span><span style="color: #000000;">&#40;</span>fault<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">description</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></td></tr></tbody></table></div>
<p>php端：</p>
<div class="codecolorer-container php mac-classic" 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 />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<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;">// Wade Arnold: 1/6/2008</span><br />
<span style="color: #666666; font-style: italic;">// Example is designed to show how to use PHP sessions.</span><br />
<span style="color: #000000; font-weight: bold;">class</span> Counter <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Check if the session is available or create it.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'count'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'count'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Used to increment the session variable count.</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> increment<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'count'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">++;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'count'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// used to destroy the session variable and start over.</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> unregister<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'count'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// remove the entire session from the server.</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> destroy<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">session_destroy</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>　　YY两句，看到热血三国的通讯方式竟然是amfphp的RPC通讯方式的， 这样的话编程模型跟普通的web项目开发就一模一样了， 现在只是说使用了Flash界面而已，开发难度大幅度降低。<br />
　　想想也是， 策略类的游戏，没必要使用客户端游戏的那种socket编程模型，开发起来复杂多了。可能游戏玩法不一样引起的。如果是有实时战斗的玩法，那必须得socket编程了吧。 </p>
<p>1. 英文相关文章</p>
<ul>
<li><span><a href="http://www.flash-db.com/" target="_blank">flash-db.com tutorials and forum on AMFPHP</a></span></li>
<li><span><a href="http://www.sephiroth.it/" target="_blank">sephiroth.it tutorials and blog on AMFPHP</a></span></li>
<li><span><a href="http://www.macromedia.com/devnet/mx/flashremoting/" target="_blank">Macromedia Remoting Developer Center</a></span></li>
<li><span><a href="http://chattyfig.figleaf.com/" target="_blank">flashcoders mailing list</a></span></li>
<li><span><a href="http://sourceforge.net/mail/?group_id=72483" target="_blank">amfphp mailing list</a></span></li>
<li><span><a href="http://www.5etdemi.com/blog" target="_blank">AMFPHP development blog</a></span></li>
<li><span><a href="http://www.flash-remoting.com/" target="_blank">Flash Remoting book companion site</a></span></li>
<li><span><a href="http://www.herrodius.com/blog/?p=23" target="_blank">Setting up PHP on your webserver</a></span></li>
<li><a href="http://soenkerohde.com/tutorials/amfphp">Sönke Rohde &#8211; tutorial</a></li>
<li><a href="http://www.jessewarden.com/archives/2005/06/flash_flex_amfp.html">Jesse Warden &#8211; Flash, Flex and AMFPHP</a></li>
<li><a href="http://www.swapdepths.nl/category/amfphp">SwapDepths tutorials</a></li>
</ul>
<p>2. 中文相关文章</p>
<ul>
<li><span><a href="http://ria.richtechmedia.com/index.php?cat=25" target="_blank">AMFPHP v1.0 MS2 tutorials</a></span></li>
<li><span><a href="http://ria.richtechmedia.com/?p=203" target="_blank">download, install, hello world</a></span></li>
<li><span><a href="http://ria.richtechmedia.com/?p=202" target="_blank">pageable recordset working examples</a></span></li>
<li><span><a href="http://ria.richtechmedia.com/?p=204" target="_blank">using web service with amfphp</a></span></li>
<li><span><a href="http://ria.richtechmedia.com/?p=205" target="_blank">authenticate with setCredential()</a></span></li>
<li><a href="http://blog.xuite.net/jameschih/java/5312447">Another hello world tutorial </a></li>
<li>luar的教学：<a href="http://www.luar.com.hk/flashbook/archives/000168.php">http://www.luar.com.hk/flashbook/archives/000168.php</a></li>
<li>淡湮mmug网聚教学：<a href="http://breezecentral.zerone.com.tw/p66309923/">http://breezecentral.zerone.com.tw/p66309923/</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.5ga.cn/blog/archives/2009/11/1832/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

