如何通过统一的wwwform传递json

我是团结的新手。

我想发送一个邮件请求,其中包含以下json数据

**url** = "http://index.php" **sampple json** = {"id":"100","name":"abc"} 

我正在使用C#

任何人都可以为我提供解决方案吗?

好吧,我正在使用这样的东西:

  public class RequestConnectionManager : Manager { public int maxSubmissionAttempts = 3; public Coroutine post() { WWWForm playForm = new WWWForm(); playForm.AddField("id", myJson.id); playForm.AddField("name", myJson.name); Post playPost = new Post("http://index.php", playForm, maxSubmissionAttempts, this); return StartCoroutine(PostWorker(playPost)); } private IEnumerator PostWorker(Post playPost) { yield return null; yield return playPost.Submit(); Debug.Log(playPost.Response); if (playPost.Error != null) { MessageBoxManager.Instance.Show("Error: " + playPost.Error, "Error", MessageBoxManager.OKCancelOptionLabels, MessageOptions.Ok); } else { try { //do whatever you want in here //Hashtable response = JsonReader.Deserialize(playPost.Response); //Debug.Log("UNITY LOG..." + response); } catch (JsonDeserializationException jsExc) { Debug.Log(jsExc.Message); Debug.Log(playPost.Response); } catch (Exception exc) { Debug.Log(exc.Message); Debug.Log(playPost.Response); } } } } //As for the Manager class... using UnityEngine; using System.Collections; // I wonder what the constraint where TManager : Singleton would produce... public class Manager : SingletonW where TManager : MonoBehaviour { override protected void Awake() { base.Awake(); DontDestroyOnLoad(this); DontDestroyOnLoad(gameObject); } } 

希望这可以帮助! =)

我已经完成了以下这样做。 我们走吧:==>

 using UnityEngine; using UnityEngine.UI; using System.Collections; using System.Collections.Generic; public class btnGetData : MonoBehaviour { void Start() { gameObject.GetComponent