导航:
论坛 -> Web应用开发
斑竹:bodies
作者:
2018/8/4 9:27:57
标题:
如何实现浏览器访问delphi的datasnap rest函数时传递多个参数?
浏览:622
加入我的收藏
楼主:
如果是利用http实现C/S连接时时,多参数没有问题可以正常实现,但是采用B/S浏览器访问时只能传递一个参数. 请教哪位达人提供一个浏览器访问传递多个参数的思路. 万分感谢!! 代码: unit ServerMethodsUnit1: function TServerMethods1.Echo(Value: string): string; begin Result := Value; end; function TServerMethods1.fun001(p1, p2: string): string; var i: Integer; begin i := Pos(p2, p1); if i>1 then Result := p1.Substring(0, i-1) else if i=1 then Result := p1.Substring(i+Length(p2), 1000) else Result := ''; end; 浏览器访问: http://localhost:8888/datasnap/rest/ServerMethods1/echo/abc 浏览器显示{result:abc} 浏览器访问: http://localhost:8888/datasnap/rest/ServerMethods1/fun001/abcdefg,cd 浏览器显示{result:}
----------------------------------------------
-
作者:
2018/8/4 17:31:22
2楼:
可以把多个参数组装成json上传
----------------------------------------------
-
作者:
2018/8/4 17:33:43
2楼:
rest无外乎通过http的get或post方法调用。 datasnap rest也是如此。 浏览器调rest是通过get方法。 get就是拼url,如下: http://192.168.1.222:5566/query?accountno=1&sql=select top 10 * from t2
----------------------------------------------
咏南中间件 QQ:254072148http://www.cnblogs.com/hnxxcxg/
作者:
2018/8/5 9:50:57
3楼:
https://www.cnblogs.com/cb168/p/5366775.html 这里有
----------------------------------------------
-
作者:
2018/8/5 10:25:43
4楼:
简单参数通过url拼接,复杂的就用xml,json
----------------------------------------------
-
作者:
2018/8/7 9:32:36
5楼:
地址改成如下就可以啊!: http://localhost:8888/datasnap/rest/ServerMethods1/fun001/abcdefg/cd 参数之间的逗号改成/
----------------------------------------------
-
作者:
2018/8/7 13:58:54
6楼:
其他人的格式 xxx?参数1=xx&参数2=xx&参数3=xx datasnap的格式 /xxxx 多个参数,自己拼装解析就好。 关键凭啥,别人都用?带参数,你要用/带
----------------------------------------------
-