当前位置:Gxlcms > PHP教程 > php的amf和flex通讯有关问题

php的amf和flex通讯有关问题

时间:2021-07-01 10:21:17 帮助过:13人阅读

php的amf和flex通讯问题
这个例子中,为什么flex 调用的时候 不按顺序就出错,就是说PHP中的差别就是
require('D:/EmpireServer/ecshop/amfphp-2.1.1/Amfphp/Services/BaseAttribute.php');
语句出现的顺序。



edit_GetMaterialType_sq.php
class edit_GetMaterialType_sq
{
function IsLogin($isadmin)
{
require('D:/EmpireServer/ecshop/amfphp-2.1.1/Amfphp/Services/BaseAttribute.php');
$reLogin = array();
$reLogin[] = 'IsLogin($isadmin)';
return $reLogin;
}

function get_materialtype()
{
$g = array();
$g[] = 'materialtype()' ;
return $g;
}

function get_templatetype($templateid,$userid)
{
require('D:/EmpireServer/ecshop/amfphp-2.1.1/Amfphp/Services/BaseAttribute.php');
$p = array();
$p[] = 'get_templatetype' ;
return $p ;
}
}
?>



BaseAttribute.php
class BaseAttribute
{
var $Width = 0;
var $Height = 0 ;
}
?>



在flex中这样调用测试的
example.mxml

xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:halo="library://ns.adobe.com/flex/halo"
xmlns:mx="library://ns.adobe.com/flex/mx"
applicationComplete="application1_applicationCompleteHandler(event)">



import mx.controls.Alert;
import mx.events.FlexEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.remoting.RemoteObject; //RemoteObject,我认为相当于OLEDB的Connection,总的连接。



protected function application1_applicationCompleteHandler(event:FlexEvent):void
{
// 在程序加载的时候运行该事件
so.IsLogin(true) //注意这三行的顺序,不这样就出错
so.get_materialtype() //注意这三行的顺序,不这样就出错
so.get_templatetype(1,1) //注意这三行的顺序,不这样就出错

}
public function RemoteFaultss(re:FaultEvent,title:String):void
{
Alert.show("Message:" +re.fault.content+":"+re.fault.faultDetail,title);
}
public function IsLoginRemoteResultss(re:ResultEvent):void
{
Alert.show( re.result.toString())

}

public function RemoteFault(re:FaultEvent,title:String):void
{
Alert.show("Message:" +re.fault.content+":"+re.fault.faultDetail,title);
}
public function IsLoginRemoteResult(re:ResultEvent):void
{
Alert.show( re.result.toString())

}
protected function button1_clickHandler(event:MouseEvent):void

{

// TODO Auto-generated method stub



}

public function RemoteFaults(re:FaultEvent,title:String):void
{
Alert.show("Message:" +re.fault.content+":"+re.fault.faultDetail,title);
}
public function IsLoginRemoteResults(re:ResultEvent):void
{
Alert.show( re.result.toString())

}



]]>




source="edit_GetMaterialType_sq">
result="{IsLoginRemoteResultss(event)}"/>
result="{IsLoginRemoteResult(event)}"/>
result="{IsLoginRemoteResults(event)}"/>











------解决方案--------------------
你的 BaseAttribute.php 文件中是一个类定义
重复加载是会出错的!
require('D:/EmpireServer/ecshop/amfphp-2.1.1/Amfphp/Services/BaseAttribute.php');
应放在外面,不能放在方法里
------解决方案--------------------
方法里会起冲突

人气教程排行