Pay for Hesitation: 丟參數給php

Pages

2008年3月16日 星期日

丟參數給php

1.利用AMFphp(此處先不介紹)


2.URLVariables來儲存參數, 再利用sendToURL(URLRequest request) 或navigateToURL(URLRequest request) 送到service.

如:
var request:URLRequest = new URLRequest("www.mydomain.com/www/test.php");
var variables:URLVariables = new URLVariables();
variables.name = "Dennis";
variabels.sid = "963388";
request.data = variables;
request.method = URLRequestMethod.POST;
sendToURL(request);
//或navigateToURL(request, "_blank"); //需要將結果頁面轉向時適用, 如:debug php codes.


3.利用HTTPService來傳遞, 下面僅介紹actionscript的方式 (亦有flex component)
如:
var httpService:HTTPService = new HTTPService();
httpService.url = "www.mydomain.com/www/test.php"
httpService.method = "POST";
var parameter:Object = {
  name:"Dennis",
  sid:"963388"
}
httpService.request = parameter;
httpService.send();

沒有留言: