(备注:此教程根据原英文教程"翻译"而来,只供个人学习时使用,翻译的质量有限,能看就凑合着看吧,大概的意思都表现出来了)
AMFPHP 1.2有什么新的东西
Amfphp 1.2 建立在amfphp 1.0 和短期的1.1版本基础上,它有以下的新的特性:
增强服务浏览
服务浏览现在可以在客户端上使用模似请求。意思就是:你不需要安装Flash就可以测试出你的服务,它对各种团队使用amfphp非常简单。测试速度也快了,代码产生被提高,支持ARP框架和自动保存。
新的文件夹结构
新的文件夹结构混乱会比较小,导航比较简单,不同版本的amfphp之间移植
提高类的映射
Amfphp now features complete class mapping options from the gateway.
What’s new in AMFPHP 1.0
A lot has changed since AMFPHP’s last version 0.9b. We’ve switched to a better engine, which allows us to add some much-wanted functionality. Here’s an outline of what’s new:
New engine
The core of the new engine was written by Justin Watkins, and was created to be 100% object oriented, secure, and reliable. Each step of the interpretation of AMF messages is carried through two chains: filters and actions. Expanding the capabilities of AMFPHP is as simple of creating a new filter or action, and modifying the chain in the right spot.
Enhanced support for different charsets
Flash uses Unicode, while PHP natively uses latin1 (ISO-8859-1). We’ve solved the babel tower by adding transparent support for charset transcoding using iconv, meaning you can work in your native language and charset, by calling the appropriate method in your gateway.php file.
Faster serialization
AMFPHP is renowned to be fast, and we’ve made it even faster by squeezing every bit of power from PHP in this new release. We’ve tightened the serializer and tweaked it for large resultsets; sending a resultset with 5 fields and 400 rows takes about 80% less time it used to. We’ve also tamed its memory usage, meaning it can be easily deployed on high-traffic servers.
Less NetConnection.Call.BadVersion error
The new loose mode sets up an output buffer to suppress echo, print and other calls to functions that output to the client to protect you from yourself. This should eliminate a good half of the common causes for the dreaded NetConnection.BadVersion error.
远程追踪
我们添加了一个新的NetDebug::输出静态方法就像在AS中的NetDebug.trace功能一样,但是它是远程工作的,它可以用到任何自定义的服务类。
Pageable recordsets
Pageable recordsets allow you to send back SQL resultsets in chunks. On the Flash side of things, Macromedia’s classes handle synchronization between the client and server and the functionality is already plugged into the data grid, meaning it is easy to work with large recordsets.
Class mapping
AMFPHP now allows mapping objects in method arguments to custom PHP classes. To use this feature all you need to do is set the type under the arguments in the method table.
Tighter integration into the service browser panel
The new version is compatible with both Macromedia’s service browser, and Muzak’s new (and better) panel. We’d like to thank Muzak who furnished the technical details on how we could achieve this.
HTML-based service browser
We’ve created our own HTML-based browser that features, in addition to service description, automatic Actionscript generation (scaffolding). That’s right, save time by browsing to your service and copy-pasting the code generated for you in Flash. Both AS2 (using the Service class) and AS1 (using NetServices.as) are generated. With a little bit of JavaDoc you can get it to generate your methodTable as well.
Tighter integration into the NetConnection Debugger
We’ve added support for new events in the NetConnection debugger, which means more verbose debugging output, which should help you figure what is going on between Flash and PHP.
Cookieless sessions
AMFPHP automatically handles sessions for you and sends back a header to Flash with a redirect to the gateway with the PHPSESSID appended to the query, meaning cookieless sessions are supported.
Authentication
Well, not really new, but it works more smoothly now because of the aforementioned cookie less sessions.
PHP5 compatibility
We’ve fixed incompatibility issues with PHP5 caused by its new pass-by-ref mechanism for class instances.
PHP5 exception support
You can now throw your own exceptions inside of your services and they will be sent back to Flash automatically in the onStatus handler.
Soap Client support
The native PHP5 SOAP extension is supported for web services, and it is much faster than NuSOAP and PEAR::SOAP alternatives.
More databases supported
SQLite, MySQLi, Oracle (oci8), Frontbase, Pear::db and PDO added to the roster of AMFPHP-compatible databases.
Transparent client header support
You can now use the Headers::getHeader($key) function anywhere in your services to get a client header by key.
FlashComm and SSL support
New headers are being sent by AMFPHP for compatibility with FlashComm and SSL.
支持新的返回类型
返回的类型可以是:二进制,原始,数组,structof, 和更多的为专门的程序。也添加了一个新的 methodTable 选项
fastArray is implemented for faster array handling for large multi-dimensional arrays.
New gateway options for deployment
disableStandalonePlayer(), disableServiceDescription(), disableTrace() and disableDebug() methods available for more secure deployement.
简单的安装和较好的文档
我们相信 AMFPHP是好的,它应被蔓延到全世界,新的文档和简单的安装程序应该可以帮助你从零开始。
A bunch of bug fixes
We’ve searched high and low and corrected FlashComm compatibility issues, authentication issues, problems with corrupted AMF messages and more.