原来的代码如此:(但是传给安卓的json数据安卓那边不可以解析)
<?
require ("config/sql_configs.php");
require ("config/function.php");
$json = @$GLOBALS['HTTP_RAW_POST_DATA'];
$arr_str1 = json_str($json);
$Belong=$arr_str1['Belong'];
$phone=$arr_str1['phone'];
$name=$arr_str1['name'];
$gender=$arr_str1['gender'];
$qq=$arr_str1['qq'];
$height=$arr_str1['height'];
$learning_time=$arr_str1['learning_time'];
$learning=$arr_str1['learning'];
$bank_txt=$arr_str1['bank_txt'];
$birthday=$arr_str1['birthday'];
$major=$arr_str1['major'];
$xl=$arr_str1['xl'];
$str=add_user($birthday,$major,$name,$gender,$qq,$phone,$bank_txt,$height,$xl,$Belong,$learning_time,$learning);
if($str==true){ //判断
$arr_25['zt']="0";
}else{
$arr_25['zt']="1";
}
echo json_encode($arr_25);
?>
修改后但有bug的代码:(没有经过判断但是安卓可以解析)
<?
require ("config/sql_configs.php");
require ("config/function.php");
$arr_25['zt']="0"; //没有判断
echo json_encode($arr_25);
$json = @$GLOBALS['HTTP_RAW_POST_DATA'];
$arr_str1 = json_str($json);
$Belong=$arr_str1['Belong'];
$phone=$arr_str1['phone'];
$name=$arr_str1['name'];
$gender=$arr_str1['gender'];
$qq=$arr_str1['qq'];
$height=$arr_str1['height'];
$learning_time=$arr_str1['learning_time'];
$learning=$arr_str1['learning'];
$bank_txt=$arr_str1['bank_txt'];
$birthday=$arr_str1['birthday'];
$major=$arr_str1['major'];
$xl=$arr_str1['xl'];
$str=add_user($birthday,$major,$name,$gender,$qq,$phone,$bank_txt,$height,$xl,$Belong,$learning_time,$learning);
?>
两个代码最终都会得到如下输出:请问大神用什么方法可以将数据做判断之后在输出,并且安卓那边可以解析。
<?
require ("config/sql_configs.php");
require ("config/function.php");
$json = @$GLOBALS['HTTP_RAW_POST_DATA'];
$arr_str1 = json_str($json);
$Belong=$arr_str1['Belong'];
$phone=$arr_str1['phone'];
$name=$arr_str1['name'];
$gender=$arr_str1['gender'];
$qq=$arr_str1['qq'];
$height=$arr_str1['height'];
$learning_time=$arr_str1['learning_time'];
$learning=$arr_str1['learning'];
$bank_txt=$arr_str1['bank_txt'];
$birthday=$arr_str1['birthday'];
$major=$arr_str1['major'];
$xl=$arr_str1['xl'];
$str=add_user($birthday,$major,$name,$gender,$qq,$phone,$bank_txt,$height,$xl,$Belong,$learning_time,$learning);
if($str==true){ //判断
$arr_25['zt']="0";
}else{
$arr_25['zt']="1";
}
echo json_encode($arr_25);
?>
修改后但有bug的代码:(没有经过判断但是安卓可以解析)
<?
require ("config/sql_configs.php");
require ("config/function.php");
$arr_25['zt']="0"; //没有判断
echo json_encode($arr_25);
$json = @$GLOBALS['HTTP_RAW_POST_DATA'];
$arr_str1 = json_str($json);
$Belong=$arr_str1['Belong'];
$phone=$arr_str1['phone'];
$name=$arr_str1['name'];
$gender=$arr_str1['gender'];
$qq=$arr_str1['qq'];
$height=$arr_str1['height'];
$learning_time=$arr_str1['learning_time'];
$learning=$arr_str1['learning'];
$bank_txt=$arr_str1['bank_txt'];
$birthday=$arr_str1['birthday'];
$major=$arr_str1['major'];
$xl=$arr_str1['xl'];
$str=add_user($birthday,$major,$name,$gender,$qq,$phone,$bank_txt,$height,$xl,$Belong,$learning_time,$learning);
?>
两个代码最终都会得到如下输出:请问大神用什么方法可以将数据做判断之后在输出,并且安卓那边可以解析。
或者你给出抓取到的数据(base64编码的)
或者你给出 url(我来抓)