2013-05-30 90 views
1

我tryied找到一些有關此信息,但有點困難,因爲我所發現的是關於JavaScript的不是Java,Java的傳遞多維數組PHP

我想知道我怎麼能在PHP得到它太因即時通訊不知道該怎麼做

我想通過郵件傳遞一個數組多維,我不知道如何傳遞一個由Java多維數組這是我的代碼(我想我只需要改變一些)

try 
    { 
     HttpClient httpclient = new DefaultHttpClient(); 
     HttpPost httppost = new HttpPost("http://web"); 

     ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); 
     for (int count=0; count < array.length; count++) 
     {//this loop is what i need to change but i dont know how to do it 
      nameValuePairs.add(new BasicNameValuePair("foto",array[count][0])); 
      nameValuePairs.add(new BasicNameValuePair("media",array[count][1])); 
      nameValuePairs.add(new BasicNameValuePair("votos",array[count][2])); 
     } 
     if(nameValuePairs != null) httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); 


     ResponseHandler<String> responseHandler = new BasicResponseHandler(); 
     httpclient.execute(httppost, responseHandler); 
    }   

回答

1

我想你應該序列化da ta到JSON/XML/CSV格式並在服務器端解析它。否則它將不是那麼智能的代碼。