5D艺术网首页
商城
|
资讯
|
作品
|
博客
|
教程
|
论坛
登录
注册
加为好友
发短消息
来自:
性别:秘密
最后登录:2009-09-05
http://walktree.5d.cn/
首页
|
新闻
|
话题
|
博客
|
相册
|
艺术作品
|
社交关系
|
留言板
|
社交圈
2006/01/11 | Flash remoting for php 小结一
类别(:: Flash ::)
|
评论
(3)
|
阅读(328)
|
发表于 12:59
学习remoting一段时间了,但用于实践还是头一回,总结了不少经验,特记录下来,备忘。
1.AmfPhp的配置
假设我的amfphp的路径是在根目录的 /amfphp
项目文件夹(假设为blog)中只须包含一个 gateway.php,如下:
<?php
include '/amfphp/app/Gateway.php';
$ gateway = new Gateway();
$ gateway->setBaseClassPath("services/");
$ gateway->service();
?>
就可以了
然后项目文件夹中建一Services文件夹存放我的php文件即可。
例如
blog.php
<?php
class blog{
.....
}
?>
2.flash方面:
我写了一个 db 类
传入你的路径和 serviceName即可.
例如:
var DB=new db("http://localhost/blog/gateway.php","blog");
如果blog在services中的文件夹walktree中,则为:
var DB=new db("http://localhost/blog/gateway.php","walktree.blog");
这有点类似java的namespace
import mx.remoting.Service;
import mx.remoting.PendingCall;
import mx.remoting.RecordSet;
import mx.rpc.RelayResponder;
import mx.rpc.FaultEvent;
import mx.rpc.ResultEvent;
import mx.remoting.debug.NetDebug;
import mx.services.Log;
//
class db
{
//remoting service
private var service : Service;
private var rs:RecordSet;
function db (gateURL : String,ServieceName:String)
{
NetDebug.initialize ();
//new service instance
//this.service = new Service (gateURL, new Log(Log.DEBUG, "infoLog"), ServieceName, null, null);
this.service = new Service (gateURL, null, ServieceName, null, null);
}
//..........your function
public function _getResult(){
return rs;
}
//clear result
public function clear(){
this.rs=undefined;
}
}
0
评论
Comments
日志分类
首页
[226]
:: Flash ::
[87]
:: php ::
[8]
::眼睛和耳朵::
[36]
::键盘时代::
[73]
::水痕专栏::
[22]