代码语言:javascript复制
using LitJson;
using System.Collections;
using UnityEngine;
public class MessageJson
{
public bool status;
public string data;
public string code;
}
public class HttpMgr : MonoBehaviour
{
// Use this for initialization
void Start () {
StartCoroutine(YeildPost());
}
IEnumerator YeildPost()
{
WWWForm form = new WWWForm();
form.AddField("mobile", "123");
form.AddField("password", "234");
WWW www = new WWW("xxx", form);
yield return www;
if (www.error != null)
{
Debug.Log("error is login:" www.error);
}
else
{
Debug.Log("request ok login: " www.text);
MessageJson jd = JsonMapper.ToObject<MessageJson>(www.text);
Debug.Log(jd.status);
}
}
}