|
using UnityEngine;
using System.Collections;
public class insert : MonoBehaviour {
        private string url="http://localhost:50163/WebSite2/Default.aspx";//本地地址
        private string txt_Name="";
        private string txt_Score="";
        private string txt_Message="";
        // Use this for initialization
        void Start () {
        
        }
        
        // Update is called once per frame
        void Update () {
        
        }
        void OnGUI()
        {
                txt_Name=GUI.TextField(new Rect(10,10,100,30),txt_Name);
                txt_Score=GUI.TextField(new Rect(10,50,100,30),txt_Score);
                txt_Message=GUI.TextField(new Rect(10,90,100,30),txt_Message);
                if(GUI.Button(new Rect(10,130,100,30),"submit"))
                {
                        StartCoroutine(InsertMethod());
                }
        }
        IEnumerator InsertMethod()
        {
                WWWForm form=new WWWForm();
                form.AddField("post_name",txt_Name);
                form.AddField("post_score",txt_Score);
                form.AddField("post_message",txt_Message);
                WWW w=new WWW(url,form);
         yield return w;
                print (w.text);
                
        }
} |
|