try
{
string postData = "controller=" + controller + "&action=" + actio + "&data=";
foreach (string item in data)
{
postData += item + ",";
}
postData = postData.Substring(0, postData.Length - 1);
string url = "";
System.Net.HttpWebRequest request
= System.Net.HttpWebRequest.Create(url) as System.Net.HttpWebRequest;
request.Method = "POST";
byte[] byte1 = Encoding.UTF8.GetBytes(postData);
// 设置请求的参数形式
request.ContentType = "application/x-www-form-urlencoded";
// 设置请求参数的长度.
request.ContentLength = byte1.Length;
// 取得发向服务器的流
C#与PHP接口交互,通过Post方式
最新推荐文章于 2021-11-27 16:59:32 发布