• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

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

php 搞代码 3年前 (2022-01-26) 34次浏览 已收录 0个评论
文章目录[隐藏]

<body>

比如用get请求 `

<code>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();    }});}</code>

}
`

然后php后台怎么接受 安卓客服端发送过来的数据

回复内容:

<body>

比如用get请求 `

<code>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();    }});}</code>

}
`

然后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']本#文来源gaodai$ma#com搞$$代**码网$能获取了


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:android – 安卓后台如何接收安卓客户端发送到php写的后台的数据 get post

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址