Php 对POST和JSONObject响应使用截击时出错

Php 对POST和JSONObject响应使用截击时出错,php,android,json,android-volley,jsonobject,Php,Android,Json,Android Volley,Jsonobject,我试图将android应用程序中的一些数据发布到我的web服务器,然后发送一个值响应,但我一直收到这个错误 Error: org.json.JSONException: Value SQLSTATE of type java.lang.String cannot be converted to JSONObject 以下是相关的android代码 JsonObjectRequest jsonObjReq = new JsonObjectRequest(Reque

我试图将android应用程序中的一些数据发布到我的web服务器,然后发送一个值响应,但我一直收到这个错误

Error: org.json.JSONException: Value SQLSTATE of type java.lang.String cannot be converted to JSONObject
以下是相关的android代码

                JsonObjectRequest jsonObjReq = new JsonObjectRequest(Request.Method.POST,
                        url, null,
                        new Response.Listener<JSONObject>() {

                            @Override
                            public void onResponse(JSONObject response) {
                                Log.d(TAG, response.toString());

                            }
                        }, new Response.ErrorListener() {

                    @Override
                    public void onErrorResponse(VolleyError error) {
                        Log.d(TAG, "Error: " + error.getMessage());

                    }
                }) {

                    @Override
                    protected Map<String, String> getParams() {
                        Map<String, String> params = new HashMap<String, String>();
                        params.put("name", regName);
                        params.put("email", regEmail);
                        params.put("password", regPassword1);

                        return params;
                    }

                };
                AppController.getInstance().addToRequestQueue(jsonObjReq, tag_json_obj);
JsonObjectRequest-jsonObjReq=新的JsonObjectRequest(Request.Method.POST,
url,空,
新的Response.Listener(){
@凌驾
公共void onResponse(JSONObject响应){
Log.d(TAG,response.toString());
}
},new Response.ErrorListener(){
@凌驾
公共无效onErrorResponse(截击错误){
Log.d(标记“Error:+Error.getMessage());
}
}) {
@凌驾
受保护的映射getParams(){
Map params=新的HashMap();
参数put(“名称”,regName);
参数put(“电子邮件”,regEmail);
参数put(“密码”,regPassword1);
返回参数;
}
};
AppController.getInstance().addToRequestQueue(jsonObjReq,tag_json_obj);
下面是相关的php代码

    <?php


$iname = $_POST['name'];
$iemail = $_POST['email'];
$ipassword = $_POST['password'];

try {


$list = array();
$x = 1;
$name = "Epic App";
$image = "http://www.example.com/feed/img/c123.jpg";
$profilePic = "http://www.example.com/feed/img/nat.jpg";
$timeStamp = "1403375851930";

while($x<=10){
    $list[] = array('id' => $x, 'name' => $name, 'image' => $image, 'profilePic' => $profilePic, 'timeStamp' => $timeStamp);
    $x++;
}
echo json_encode(array('feed' => $list));

exit;

}
catch(PDOException $e) {
    echo $e->getMessage();
    exit();
}

?>

php中有更多的代码,但我把它去掉了,因为我认为它不相关,只是查询等等


感谢您的帮助

如果使用JsonObjectRequest,您可以将param作为JSONObject而不是getParams(…)

以下即:

JSONObject o = new JSONObject();
o.put("name", regName);
o.put("email", regEmail); 
o.put("password", regPassword1); 
JsonObjectRequest jsonObjReq = new JsonObjectRequest(Request.Method.POST, url, o,.. );