如何在Adobe Flex3中的Httpservice中发送数组
我不太确定你将数组发送到httpservice是什么意思.如果您要将数组发送到具有相同字段名称的httpservice,则可以将数组作为字段值传递.
var service:HTTPService = new HTTPService(); service.useProxy = true; service.destination = "myservicet"; service.resultFormat = HTTPService.RESULT_FORMAT_XML; var fields:Array = ["categories", "organisation"]; var params:Object = new Object(); params.q = "stackoverflow"; params.rows = 0; params.facet = "true"; params["facet.field"] = fields; service.send(params);
HTTPService会将其转换为url参数:
facet=true&q=stackoverflow&facet%2Efield=categories&facet%2Efield=organisation&rows=0
希望这可以帮助!
添加更清晰.当数组中只有一个参数时,不要将字段作为数组传递.出于某种原因,flex不会将此信息发送到http服务