标签:
public class LitJsonWeb : MonoBehaviour
{
public static LitJsonWeb lj;
public string str_code, str_ieme, str_requst, jsonStr;
public string Info;
void Start()
{
lj = this;
str_ieme = SystemInfo.deviceUniqueIdentifier;//获取手机串号
}
void Update()
{
EasyCodeScannerExample other = GameObject.Find("Main Camera").GetComponent<EasyCodeScannerExample>();
str_code = other.dataStr;//获取二维码
JsonData date = new JsonData();
date["code"] = str_code;
date["imei"] = str_ieme;//json转换格式
jsonStr = date.ToJson();
}
public void Post_()
{
StartCoroutine(post());
}
IEnumerator post()
{
string url = "*****************";//获取服务器接口地址
byte[] post_date;//字节流数组
string str_post;
WWWForm wwF = new WWWForm();
wwF.AddField("code",str_code);
wwF.AddField("imei",str_ieme);
WWW getData = new WWW(url, wwF);
yield return getData;
if (getData.error != null)
{
str_requst = getData.error.ToString();
yield return null;
}
else
{
this.str_requst = getData.text;//接受服务器端返回的参数
}
}
}
标签:
原文地址:http://www.cnblogs.com/hmbz/p/5583546.html