0
我是Android開發新手。我將Android的JSON數據發送到我的PHP服務器。但我發現了一個錯誤:解析JSON時出錯
Error parsing data org.json.JSONException: Value `<br` of type java.lang.String cannot be converted to JSONObject".
這是我的PHP代碼:
<?php
$con = mysql_connect("localhost","custome234r","reswtdf123");
if (!$con)
die('Could not connect: ' . mysql_error());
mysql_select_db("customer_dd_test", $con);
$jsonFeedbackResult = $_REQUEST['results'];
$flagToOpenTicket = false;
$arrResult = json_decode(stripslashes_deep($jsonFeedbackResult));
$feedbackname = $arrResult[0]['feedbackname'];
$email = $arrResult[0]['email'];
unset($arrResult[0]);
$finalArray = array_values($arrResult);
foreach($finalArray as $key => $arrQuestionWithAnswer)
{
if($arrQuestionWithAnswer['answer'] == 'bad' || $arrQuestionWithAnswer['answer'] == 'worst')
{
$flagToOpenTicket = true;
break;
}
}
if($flagToOpenTicket)
{
$insertQuery = 'INSERT INTO dev_ticket(email, feedbackname) VALUES';
$insertQuery .= '("'.$email.'", "'.$feedbackname.'"),';
$executeQuery = trim($insertQuery,',');
mysql_query($executeQuery);
}
mysql_close($con);
print(json_encode(array('response'=>$feedbackname)));
?>
我打印了我的php代碼以供參考。 – Rohit13 2012-08-06 04:41:37