[AS3.0]一步一步学ActionScript 3.0(十八)

这节来看一下amfphp,下载后,解压得到一个amfphp的文件夹,将它放到网站根目录(注意PHP环境要配置好),这样就配置好了,配置比较简单。

在浏览器上输入: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.

View the amfphp documentation

Load the service browser

 amfphp有一好处是可能调试你写的remoting,这样你不用写FLASH端,就可以知道你的REMOTING写的是不是正确的了,点击上面的文字的最下面一行链接,Load the service browser 就可以进入了,或者在浏览器上输入:http://localhost/amfphp/browser/index.html

同样写一个简单PHP端代码:

<? php

class  Hello
{
    
function  Hello()
    {
    }

    
function  sayHello( $nameStr )
    {
        
return   " hello!  " . $nameStr ;
    }
}

生成一个Hello.php文件,我们要放在amfphp里的services目录里,这里我们在services里建一个上一节中的目录结构net/smilecn/helloWorld,然后将Hello.php放在helloWorld里

FLASH端的代码只需要改一句代码:

 把

private  var gateWayUrl:String  =   " http://localhost:8080/flashService/gateway " ;

改成

private  var gateWayUrl:String  =   " http://localhost/amfphp/gateway.php " ;

就可以了,其它代码不用变。

下节继续。

(本教程如需转载请注明出处!)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值