另一个PHP JSONException:Value <br of =“”type =“”java.lang.string =“”can =“”be =“”converted =“”to =“”jsonobject

时间:2016-09-02 17:26:54

标签: java php android jsonexception

2 个答案:

答案 0 :(得分:1)

使用

Log.i(“tagconvertstr”,“[”+ response +“]”); 查看返回的响应

行前

JSONObject jsonResponse = new JSONObject(response);

RegisterActivity.java中的

答案 1 :(得分:0)

这是因为混合了mysql_和mysqli _

如果你做了一切mysqli_

<?php

$con = mysqli_connect("127.0.0.1","root","", "yield");


    $name = $_POST["name"];
    $age = $_POST["age"];
    $username = $_POST["username"];
    $password = $_POST["password"];
    $statement = mysqli_prepare($con, "INSERT INTO users (name, username, age, password) VALUES (?, ?, ?, ?)") or die (mysqli_error($con));
    mysqli_stmt_bind_param($statement, "siss", $name, $username, $age, $password);
    mysqli_stmt_execute($statement);

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

    echo json_encode($response);
?>

然后它的作品!