1、安装WAMP5(运行PHP的环境)
下载地址:http://www.crsky.com/soft/10723.html WAMP5 v1.7.4
(本人安装的路径为 C:\wamp\,其中"www"文件内放网站的文件)
2、安装amfphp
下载地址:http://sourceforge.net/projects/amfphp/files/
3、解压后的 amfphp复制到服务器根目录("www"文件夹)下。如:C:\wamp\www\amfphp
4、测试amfphp
如:http://localhost/amfphp/gateway.php
安装成功的话,会看到以下信息:
amfphp and this gateway are installed correctly. You may now connect to this gateway from Flash.
Note: If you're reading an old tutorial, it will tell you that you should see a download window instead of this message. This confused people so this is the new behaviour starting from amfphp 1.2.
5、PHP端测试例子HelloWorld程序
在C:\wamp\www\amfphp\services目录,新建一个HelloWorld.php文件,在文件中输入以下代码:
<?php
class HelloWorld
{
function sayHello()
{
return "Hello World!";
}
}
?>
class HelloWorld
{
function sayHello()
{
return "Hello World!";
}
}
?>
6、Flex端测试例子AMFphp
(1)src内,新建一个xml文档:services-config.xml,内容如下:
<?xml version="1.0" encoding="utf-8"?>
<services-config>
<services>
<service id="amfphp-flashremoting-service" class="flex.messaging.service.RemotingService" messageTypes="flex.messaging.messages.RemotingMessage">
<destination id="amfphp">
<channels>
<channel ref="my-amfphp" />
</channels>
<properties>
<source>*</source>
</properties>
</destination>
</service>
</services>
<channels>
<channel-definition id="my-amfphp" class="mx.messaging.channels.AMFChannel">
<endpoint uri="http://127.0.0.1/amfphp/gateway.php" class="flex.messaging.endpoints.AMFEndpoint" />
</channel-definition>
</channels>
</services-config>
<services-config>
<services>
<service id="amfphp-flashremoting-service" class="flex.messaging.service.RemotingService" messageTypes="flex.messaging.messages.RemotingMessage">
<destination id="amfphp">
<channels>
<channel ref="my-amfphp" />
</channels>
<properties>
<source>*</source>
</properties>
</destination>
</service>
</services>
<channels>
<channel-definition id="my-amfphp" class="mx.messaging.channels.AMFChannel">
<endpoint uri="http://127.0.0.1/amfphp/gateway.php" class="flex.messaging.endpoints.AMFEndpoint" />
</channel-definition>
</channels>
</services-config>