Php 价值<;由于存在日期时间数据,无法将java.lang.String类型的br转换为JSONObject

Php 价值<;由于存在日期时间数据,无法将java.lang.String类型的br转换为JSONObject,php,android,mysql,datetime,android-volley,Php,Android,Mysql,Datetime,Android Volley,我一直在努力尝试将数据成功地插入MySQL数据库(使用截击),这不是问题,因为数据被插入了,但我一直有这个错误W/System.err:org.json.JSONException:Value

我一直在努力尝试将数据成功地插入MySQL数据库(使用截击),这不是问题,因为数据被插入了,但我一直有这个错误W/System.err:org.json.JSONException:Value或JSONException,这个错误是停止做任何其他事情,如果我添加更多的代码UI冻结,我试图删除我的php文件的日期代码,一切都很好,只有datetime值不是我要找的,当我添加回来,它再次显示错误。 这是我的代码:

    Response.Listener<String> responseListener1 = new Response.Listener<String>() {
                                                                    @Override
                                                                    public void onResponse(String response) {
                                                                        try {
                                                                            JSONObject jsonResponse1 = new JSONObject(response);
                                                                            boolean success = jsonResponse1.getBoolean("success");
                                                                            if (success) {


                                                                                Toast.makeText(MapActivity.this, "SUCCESS",Toast.LENGTH_LONG).show();


                                                                            } else {
                                                                                Toast.makeText(MapActivity.this, "INSERTION FAILED",Toast.LENGTH_LONG).show();


                                                                            }


                                                                        } catch (JSONException e) {
                                                                            e.printStackTrace();
                                                                            Toast.makeText(MapActivity.this, "EXCEPTION",Toast.LENGTH_LONG).show();
                                                                        }


                                                                    }
                                                                };




                                                                SendBookingRequest bookingRequest = new SendBookingRequest(idd,em,Adresse_source,duree,dist, responseListener1);
                                                                RequestQueue queue1 = Volley.newRequestQueue(MapActivity.this);
                                                                queue1.add(bookingRequest);
Response.Listener responseListener1=新的Response.Listener(){
@凌驾
公共void onResponse(字符串响应){
试一试{
JSONObject jsonResponse1=新的JSONObject(响应);
boolean success=jsonResponse1.getBoolean(“success”);
如果(成功){
Toast.makeText(MapActivity.this,“SUCCESS”,Toast.LENGTH_LONG.show();
}否则{
Toast.makeText(MapActivity.this,“插入失败”,Toast.LENGTH_LONG.show();
}
}捕获(JSONException e){
e、 printStackTrace();
Toast.makeText(MapActivity.this,“EXCEPTION”,Toast.LENGTH_LONG.show();
}
}
};
SendBookingRequest bookingRequest=新的SendBookingRequest(idd、em、地址来源、duree、dist、responseListener1);
RequestQueue queue1=Volley.newRequestQueue(MapActivity.this);
队列1.添加(预订请求);
这是我的php文件SendBookingRequest

<?php
require("password.php");
$connect = mysqli_connect("localhost", "XXXXX", "XXXXX", "XXXXX");

$driver_id = $_POST["driver_id"];
$email = $_POST["email"];
$adresse_source = $_POST["adresse_source"];
$duree = $_POST["duree"];
$distance = $_POST["distance"];
$response = array();
$dt_obj = new DateTime($response['send_moment'], new 
DateTimeZone('America/Chicago')); 
$dt_obj->setTimezone(new DateTimeZone('Europe/London')); 
$send_time = $dt_obj->format('Y-m-d H:i:s'); 
   echo $send_time;
 function AddRequest() {
    global $connect, $driver_id, $email, $adresse_source, $duree, $distance, $send_time ; 
    $statement = mysqli_prepare($connect, "INSERT INTO demande (driver_id, pass_id, adresse_source, duree, distance, send_moment) VALUES (?, (SELECT user_id FROM passager WHERE email = ?),?, ?, ?, ?)");
    mysqli_stmt_bind_param($statement, "issdis", $driver_id, $email, $adresse_source, $duree, $distance, $send_time); 
    mysqli_stmt_execute($statement);
    mysqli_stmt_close($statement);     
}


    $response["success"] = false;  

    AddRequest();
    $response["success"] = true;  


echo json_encode($response);
?>


任何帮助都将不胜感激。

我认为您需要将
标题('Content-type:application/json')echo json_encode($response)上方的行和显示该数据样本的尴尬想法如何?对不起,您能解释一下您的意思吗?显示您试图解析的导致您遇到问题的字符串我如何获取它!!,对不起,我是个新手?设置断点并使用调试器运行?我将添加它。当我与Marcin Orlowski讨论时,我发现错误的来源是不确定的索引发送时间