gpt4 book ai didi

java - 似乎
转载 作者:行者123 更新时间:2023-12-02 03:53:10 30 4
gpt4 key购买 nike

org.json.JSONException:java.lang.String类型的值

据我所知...我收到了一个被 HTML 污染的字符串,但我不知道为什么!

我花了几个小时在互联网上研究这个问题,但没有找到任何匹配的回复。

如有任何建议,我们将不胜感激!

新的 Logcat 响应:

   02-29 19:09:05.378 10027-10027/? I/art: Not late-enabling -Xcheck:jni (already on)
02-29 19:09:05.501 10027-10027/k.unionapp W/System: ClassLoader referenced unknown path: /data/app/k.unionapp-2/lib/x86
02-29 19:09:05.888 10027-10027/k.unionapp D/gralloc_goldfish: Emulator without host-side GPU emulation detected.
02-29 19:09:28.450 10027-10413/k.unionapp I/custom_check: The values received in the store part are as follows:
02-29 19:09:28.450 10027-10413/k.unionapp I/custom_check: <br />
<b>Notice</b>: Use of undefined constant fname - assumed 'fname' in <b>C:\xampp\htdocs\getuserdata.php</b> on line <b>22</b><br />
<br />
<b>Notice</b>: Use of undefined constant lname - assumed 'lname' in <b>C:\xampp\htdocs\getuserdata.php</b> on line <b>23</b><br />
<br />
<b>Notice</b>: Use of undefined constant email - assumed 'email' in <b>C:\xampp\htdocs\getuserdata.php</b> on line <b>24</b><br />
<br />
<b>Notice</b>: Use of undefined constant password - assumed 'password' in <b>C:\xampp\htdocs\getuserdata.php</b> on line <b>25</b><br />
<br />
<b>Notice</b>: Use of undefined constant fname - assumed 'fname' in <b>C:\xampp\htdocs\getuserdata.php</b> on line <b>22</b><br />
<br />
<b>Notice</b>: Use of undefined constant lname - assumed 'lname' in <b>C:\xampp\htdocs\getuserdata.php</b> on line <b>23</b><br />
<br />
<b>Notice</b>: Use of undefined constant email - assumed 'email' in <b>C:\xampp\htdocs\getuserdata.php</b> on line <b>24</b><br />
<br />
<b>Notice</b>: Use of undefined constant password - assumed 'password' in <b>C:\xampp\htdocs\getuserdata.php</b> on line <b>25</b><br />
{"fname":"t","lname":"t","email":"t","password":"t"}
02-29 19:09:28.450 10027-10413/k.unionapp W/System.err: org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject
02-29 19:09:28.450 10027-10413/k.unionapp W/System.err: at org.json.JSON.typeMismatch(JSON.java:111)
02-29 19:09:28.450 10027-10413/k.unionapp W/System.err: at org.json.JSONObject.<init>(JSONObject.java:160)
02-29 19:09:28.450 10027-10413/k.unionapp W/System.err: at org.json.JSONObject.<init>(JSONObject.java:173)
02-29 19:09:28.450 10027-10413/k.unionapp W/System.err: at k.unionapp.ServerRequests$getUserDataAsyncTask.doInBackground(ServerRequests.java:89)
02-29 19:09:28.451 10027-10413/k.unionapp W/System.err: at k.unionapp.ServerRequests$getUserDataAsyncTask.doInBackground(ServerRequests.java:38)
02-29 19:09:28.451 10027-10413/k.unionapp W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:295)
02-29 19:09:28.451 10027-10413/k.unionapp W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
02-29 19:09:28.451 10027-10413/k.unionapp W/System.err: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
02-29 19:09:28.451 10027-10413/k.unionapp W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
02-29 19:09:28.451 10027-10413/k.unionapp W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
02-29 19:09:28.451 10027-10413/k.unionapp W/System.err: at java.lang.Thread.run(Thread.java:818)
02-29 19:09:28.628 10027-10045/k.unionapp W/art: Suspending all threads took: 28.998ms
02-29 19:09:29.103 10027-10027/k.unionapp I/Choreographer: Skipped 42 frames! The application may be doing too much work on its main thread.

getuserdata.php 文件:

<?php

$user = "root";
$pass = "";
$db = "uopuser";

$con=mysqli_connect("localhost", $user, $pass, $db) or die("Unable to connect");

$email = $_POST["email"];
$password = $_POST["password"];

$statement = mysqli_prepare($con, "SELECT * FROM User WHERE email = ? AND password = ?");
mysqli_stmt_bind_param($statement, "ss", $email, $password);
mysqli_stmt_execute($statement);

mysqli_stmt_store_result($statement);
mysqli_stmt_bind_result($statement, $user_id, $fname, $lname, $email, $password);

$user = array();

while(mysqli_stmt_fetch($statement)){
$user[fname] = $fname;
$user[lname] = $lname;
$user[email] = $email;
$user[password] = $password;
}

echo json_encode($user);

mysqli_stmt_close($statement);

mysqli_close($con);

?>

最佳答案

这是一个错误响应,可能与非 200 状态代码配对。

您需要服务器上的电子邮件参数,但您发送用户名。找不到 email 并且 php 产生错误。

您应该向您的服务器添加错误处理。要解决您的问题,请更改为服务器上的用户名或Java中的电子邮件

关于java - 似乎 <br 正在进入我的 JSON 响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35707304/

30 4 0

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