gpt4 book ai didi

java - AsyncHttpResponseHandler 未定义发送参数;RequestParams、android、java、php

转载 作者:行者123 更新时间:2023-11-30 00:56:05 26 4
gpt4 key购买 nike

我有这段代码可以将数据上传到数据库

RequestParams params = new RequestParams();
//prgDialog.show();
params.put("usersJSON", controller.getAllAnswerSheet());
System.out.println("onSuccess getAllAnswerSheet" + controller.numberOfRows("answer_sheet_tbl"));
System.out.println("onSuccess getAllAnswerSheet" + controller.getAllAnswerSheet());
// Make Http call to updatesyncsts.php with JSON parameter which has Sync statuses of Users
client.post("http://127.0.0.1/qna/process/uploadanswersheet.php", params, new AsyncHttpResponseHandler() {

我知道我有数据,因为我在日志中得到了它

[{
"answer": [{
"sysid": "1",
"surveyid": "1",
"questionid": "0",
"answerid": "",
"householdid": "1",
"status": "active"
}, {
"sysid": "2",
"surveyid": "1",
"questionid": "0",
"answerid": "",
"householdid": "2",
"status": "active"
}, {
"sysid": "3",
"surveyid": "1",
"questionid": "0",
"answerid": "",
"householdid": "3",
"status": "active"
}, {
"sysid": "4",
"surveyid": "1",
"questionid": "0",
"answerid": "",
"householdid": "4",
"status": "active"
}, {
"sysid": "5",
"surveyid": "1",
"questionid": "0",
"answerid": "",
"householdid": "5",
"status": "active"
}, {
"sysid": "6",
"surveyid": "1",
"questionid": "0",
"answerid": "",
"householdid": "6",
"status": "active"
}, {
"sysid": "7",
"surveyid": "1",
"questionid": "0",
"answerid": "",
"householdid": "7",
"status": "active"
}, {
"sysid": "8",
"surveyid": "1",
"questionid": "1",
"answerid": "aklan",
"householdid": "8",
"status": "active"
}, {
"sysid": "9",
"surveyid": "1",
"questionid": "2",
"answerid": "kalibo",
"householdid": "9",
"status": "active"
}, {
"sysid": "10",
"surveyid": "1",
"questionid": "3",
"answerid": "7",
"householdid": "10",
"status": "active"
}, {
"sysid": "11",
"surveyid": "1",
"questionid": "3",
"answerid": "7",
"householdid": "11",
"status": "active"
}, {
"sysid": "12",
"surveyid": "1",
"questionid": "3",
"answerid": "7",
"householdid": "12",
"status": "active"
}, {
"sysid": "13",
"surveyid": "1",
"questionid": "6",
"answerid": "three",
"householdid": "13",
"status": "active"
}, {
"sysid": "14",
"surveyid": "1",
"questionid": "6",
"answerid": "three",
"householdid": "14",
"status": "active"
}, {
"sysid": "15",
"surveyid": "1",
"questionid": "7",
"answerid": "patwo",
"householdid": "15",
"status": "active"
}, {
"sysid": "16",
"surveyid": "1",
"questionid": "7",
"answerid": "pathree",
"householdid": "16",
"status": "active"
}, {
"sysid": "17",
"surveyid": "1",
"questionid": "7",
"answerid": "pathree",
"householdid": "17",
"status": "active"
}],
"survey": [{
"sysid": "17",
"householdnum": "74",
"barangay": "manila",
"headfname": "martin",
"headmname": "",
"headlname": "manalo",
"headsuffix": "",
"status": "active"
}]
}]

我的问题出在我的 uploadanswersheet.php 页面上,我得到 Undefined index: usersJSON 意思是我无法发送参数中的数据。

这是我在 uploadanswersheet.php 中的代码:

//Get JSON posted by Android Application
$json = $_POST["usersJSON"];
//Remove Slashes
$json = json_decode(stripslashes($json), true);
//if (get_magic_quotes_gpc()){
//$json = stripslashes($json);
//}

最佳答案

将 JSON 转换为字符串并发布。并在服务器端将字符串转换回 JSON

关于java - AsyncHttpResponseHandler 未定义发送参数;RequestParams、android、java、php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40147560/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com