0
我面臨的問題是從PHP數組中獲取數據。我使用var_dump($_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());
}
不應該是一個問題,得到它,因爲你」沒有得到任何東西,我會麻煩拍攝應用程序正確發佈。 – 2011-05-31 16:55:18
我們需要看一些實際的代碼。 – 2011-05-31 16:55:37
它不應該是[Android]的問題,也許你的代碼,嘗試更新你的代碼片段,將看到它的工作原理。 @David Nguyen:很高興在這裏看到一位越南人^^ – 2011-05-31 17:01:31