接收帖子数据时出现问题

问题描述

| 我面临从PHP中的帖子数组获取数据的问题。我用“ 0”进行调试。 它显示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());
            }
    

解决方法

        尝试看看$ HTTP_RAW_POST_DATA 或尝试通过
<?php $postdata = file_get_contents(\"php://input\"); ?>