C# unity3D get post

xiaoxiao2021-02-27  361

C#  IEnumerator     搜索 

yield return

//测试GET方法   StartCoroutine(SendGet("http://postman-echo.com/time/now"));   //测试POST方法           var form = new WWWForm();           form.AddField("int", "6");           StartCoroutine(SendPost("http://kun.show.ghostry.cn/", form));      IEnumerator SendGet(string _url)   {     WWW getData = new WWW(_url);       yield return getData;         if(getData.error != null)           {               Debug.Log(getData.error);            }           else           {                Debug.Log(getData.text);            }       }  IEnumerator SendPost(string _url, WWWForm _wForm)       {           WWW postData = new WWW(_url, _wForm);           yield return postData;           if (postData.error != null)           {               Debug.Log(postData.error);           }           else           {               Debug.Log(postData.text);           }       } 
转载请注明原文地址: https://www.6miu.com/read-5583.html

最新回复(0)