您好,欢迎访问一九零五行业门户网

android - 安卓后台如何接收安卓客户端发送到php写的后台的数据 get post

比如用get请求 `
public class mainactivity extends activity {private edittext name;private edittext age;@overrideprotected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); name=(edittext) findviewbyid(r.id.edittext1); age=(edittext) findviewbyid(r.id.edittext2); button regist= (button) findviewbyid(r.id.button1); regist.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { string url=http://testshitou.sinaapp.com/http.php; url=url+?name=+name.gettext().tostring()+&age=+age.gettext().tostring(); new httpclentthread(url).start(); }});}

}
`
然后php后台怎么接受 安卓客服端发送过来的数据
回复内容: 比如用get请求 `
public class mainactivity extends activity {private edittext name;private edittext age;@overrideprotected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); name=(edittext) findviewbyid(r.id.edittext1); age=(edittext) findviewbyid(r.id.edittext2); button regist= (button) findviewbyid(r.id.button1); regist.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { string url=http://testshitou.sinaapp.com/http.php; url=url+?name=+name.gettext().tostring()+&age=+age.gettext().tostring(); new httpclentthread(url).start(); }});}

}
`
然后php后台怎么接受 安卓客服端发送过来的数据
虽然不知道你写的是app还是服务器,但是get post请求是不区分平台的。
无论是python, c++ , php 还是 java 写的后台接口,前端都可以直接发请求到服务器。
无论是android, web, os x app 还是 ios app, 客户端发的请求服务器都可以受理。
后台get post接收跟安卓客户端没有什么关系,你后台支持get post就行,剩下的,客户端知道怎么去做,不管是安卓、ios还是wp。
题目应该改为《php如何接收客户端发送的get/pos参数》,跟android完全没有关系。在浏览器输入http://testshitou.sinaapp.com/http.php?name=我的名字&age=18等同get请求。
例如,接收name参数,php里面_get['name']或者_post['name']就能获取了
其它类似信息

推荐信息