android - 安卓後台如何接收安卓用戶端發送到php寫的背景資料 get post

來源:互聯網
上載者:User

比如用get請求 `

public class MainActivity extends Activity {private EditText name;private EditText age;@Overrideprotected void onCreate(Bundle savedInstanceState) {    super.onCreate(savedInstanceState);    setContentView(R.layout.activity_main);   name=(EditText) findViewById(R.id.editText1);   age=(EditText) findViewById(R.id.editText2);  Button regist= (Button) findViewById(R.id.button1);  regist.setOnClickListener(new OnClickListener() {        @Override    public void onClick(View v) {        String url="http://testshitou.sinaapp.com/http.php";        url=url+"?name="+name.getText().toString()+"&age="+age.getText().toString();        new HttpClentThread(url).start();    }});}

}
`

然後php後台怎麼接受 安卓客服端發送過來的資料

回複內容:

比如用get請求 `

public class MainActivity extends Activity {private EditText name;private EditText age;@Overrideprotected void onCreate(Bundle savedInstanceState) {    super.onCreate(savedInstanceState);    setContentView(R.layout.activity_main);   name=(EditText) findViewById(R.id.editText1);   age=(EditText) findViewById(R.id.editText2);  Button regist= (Button) findViewById(R.id.button1);  regist.setOnClickListener(new OnClickListener() {        @Override    public void onClick(View v) {        String url="http://testshitou.sinaapp.com/http.php";        url=url+"?name="+name.getText().toString()+"&age="+age.getText().toString();        new HttpClentThread(url).start();    }});}

}
`

然後php後台怎麼接受 安卓客服端發送過來的資料

雖然不知道你寫的是APP還是伺服器,但是GET POST請求是不區分平台的。
無論是Python, C++ , PHP 還是 Java 寫的後台介面,前端都可以直接發請求到伺服器。
無論是Android, Web, OS X App 還是 iOS App, 用戶端發的請求伺服器都可以受理。

後台get post接收跟安卓用戶端沒有什麼關係,你後台支援get post就行,剩下的,用戶端知道怎麼去做,不管是安卓、iOS還是WP。

題目應該改為《php如何接收用戶端發送的get/pos參數》,跟android完全沒有關係。在瀏覽器輸入http://testshitou.sinaapp.com/http.php?name=我的名字&age=18等同get請求。

例如,接收name參數,php裡面_GET['name']或者_POST['name']就能擷取了

  • 相關文章

    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.