public String SendPost(String postName[],String postValue[]) throws Exception 
{
    URL PostUrl = new URL(strUrl);
    HttpURLConnection connection = (HttpURLConnection)PostUrl.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
PrintWriter outData = new PrintWriter(connection.getOutputStream());
//encode the message
String strPostData="",strPostName="";
for(int i=0;i<postName.length;i++)
{
strPostName = postName[i];
strPostData += postName[i] + "=" + URLEncoder.encode(postValue[i],"UTF-8") + "&";
}
//send the encoded message
outData.println(strPostData);
outData.close(); return strPostData;
}
调用这个函数时,如果把postValue[i]直接写成字符串,如"测试",接收的url就正确,但是通过postValue[i]就不行了