我有一个需要带两个参数的php脚本:
if (isset($_GET["category"]) && isset($_GET["book"])) {
$category= $_GET['category'];
$book= $_GET['book'];
$result = mysql_query("SELECT * FROM colection WHERE category='$category' AND book='$book'");
//rest of the code
}
我使用Intent
将数据从活动传递到第三个活动:
Intent passedCategory =getIntent();
String vCategory = passedCategory.getStringExtra("category");
Intent passedBook =getIntent();
String vBook = passedBook.getStringExtra("book");
来自此tutorial我使用ServiceHandler.java
进行http
来电,我修改了MainActivity.java
(来自同一个tutorial)使用。更改很小,例如XML
文件的名称,class
名称等等。我想我需要在doInBackground
(makeServiceCall(URL,ServiceHandler.GET, HERE)
)中以某种方式添加参数:
protected Void doInBackground(Void... arg) {
// Intent from above
ServiceHandler serviceClient = new ServiceHandler();
Log.d("url: ", "> " + URL);
String json = serviceClient.makeServiceCall(URL,ServiceHandler.GET);
Log.d("Get colections response: ", "> " + json);
if (json != null) {
//rest of the code
}
}
我想将参数发送到php
脚本,以便它可以正确过滤,我该怎么做?