Php 邮政数据接收中的问题
在php中,我面临从post数组获取数据的问题。我使用Php 邮政数据接收中的问题,php,android,post,Php,Android,Post,在php中,我面临从post数组获取数据的问题。我使用var\u dump($\u POST)进行调试。 它显示0{}。我正在从android应用程序发送数据。我不确定我的问题是什么。 它与内容类型有关吗?我的内容类型是 <meta http-equiv="Content-Type" content=" text/html; charset=UTF-8"> 我的android代码是 client=new DefaultHttpClient(); Http
var\u dump($\u POST)
进行调试。
它显示0{}。我正在从android应用程序发送数据。我不确定我的问题是什么。
它与内容类型有关吗?我的内容类型是
<meta http-equiv="Content-Type" content=" text/html; charset=UTF-8">
我的android代码是
client=new DefaultHttpClient();
HttpPost request=new HttpPost("http://10.0.2.2/php_server/index.php");
List<NameValuePair>p=new ArrayList<NameValuePair>(1);
p.add(new BasicNameValuePair("android","data received"));
HttpEntity entity;
try
{
request.setEntity(new UrlEncodedFormEntity(p));
HttpResponse response=client.execute(request);
}
catch(Exception e)
{
Log.e("socket connection", e.toString());
}
client=newdefaulthttpclient();
HttpPost请求=新建HttpPost(“http://10.0.2.2/php_server/index.php");
Listp=新阵列列表(1);
p、 添加(新的BasicNameValuePair(“android”,“已接收数据”);
http实体;
尝试
{
setEntity(新的UrlEncodedFormEntity(p));
HttpResponse response=client.execute(请求);
}
捕获(例外e)
{
Log.e(“套接字连接”,例如toString());
}
尝试查看
或者试着过日子
<?php $postdata = file_get_contents("php://input"); ?>
这不应该是个问题,因为你没有得到任何东西,我会在正确发布应用程序时遇到问题。我们需要看到一些实际的代码。安卓系统应该没有问题,也许你的代码,尝试更新一段代码,就会看到它是如何工作的@David Nguyen:很高兴在这里看到越南人^^进行了快速搜索,您完成了本教程的清单部分了吗@David Nguyen是的,我有。(-1)你应该提供你的方法和问题的解决方案,而不是张贴与问题无关的东西,至少你要解释一些。。。