FlexPost数据到PHP的实现。实现也很简单,利用URLLoader,URLRequest,URLRequestMethod类实现。
直接上代码:
private var mHttpService:URLLoader;
private var mHttpUrlRequest:URLRequest;
public function THttpServiceCore()
{
mHttpService=new URLLoader();
mHttpUrlRequest=new URLRequest(TGlobalAppCore.ServerURL);
mHttpUrlRequest.method=URLRequestMethod.POST;
}
public function PostData(longitude:String, latitude:String):void
{
//设置要传输的参数
var mHttpParameters:URLVariables=new URLVariables();
//userid是根据PHP端字段来设置,然后赋值
mHttpParameters.userid=1;
mHttpParameters.logid=1;
mHttpParameters.logtime=FlexGlobals.topLevelApplication.GetCurrentTime();
mHttpUrlRequest.data=mHttpParameters;
//启动监听
mHttpService.addEventListener(Event.COMPLETE, PostComplete);
//提交
mHttpService.load(mHttpUrlRequest);
}
private function PostComplete(e:Event):void
{
trace("完成");
}彭亚欧个人博客原创文章,转载请注明出处
文章关键词:Flex POST,Flex提交数据到PHP,Flex-PHP
文章固定链接:https://www.pengyaou.com/homeart/OTA=.html
上一篇 细说网页制作
下一篇 Flex+C#在线网页聊天室