赞
踩
IEnumerator Upload() { string question = input.text; UnityWebRequest www = UnityWebRequest.Post("url要访问的网址", question); yield return www.SendWebRequest(); if (www.result != UnityWebRequest.Result.Success) { Debug.Log(www.error); } else { Debug.Log("Form upload complete!"); } }
IEnumerator GetText() { UnityWebRequest wwwGet = UnityWebRequest.Get("url要访问的网址"); yield return wwwGet.SendWebRequest(); if (wwwGet.result != UnityWebRequest.Result.Success) { Debug.Log(wwwGet.error); } else { // 以文本形式显示结果 Debug.Log(wwwGet.downloadHandler.text); byte[] results = wwwGet.downloadHandler.data; print(results); } }
from flask import Flask
from flask import request
app = Flask(__name__)
@app.route("/",methods=['POST', 'GET'])
def hello_world():
question =''.join(request.form.keys())
print(question)//接收到的数据
answer = "要返回到客户端的数据"
return answer
if __name__ == '__main__':
app.run()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。