html json错误,第1行json解析错误:< html >< body >

我不知道为什么代码不工作,它应该编码为json? 当我打电话从应用这个PHP代码链接的Android工作室它不工作并显示错误消息,它显示这个代码:第1行json解析错误:< html >< body >

src = "/aes.js" > < /script>

function(d) {

e.push(parseInt(d, 16))

});

return e

}

function toHex() {

for (var d = [], d = 1 == arguments.length && arguments[0].constructor == Array ? arguments[0] : arguments, e = "", f = 0; f < d.length; f++) e += (16 > d[f] ? "0" : "") + d[f].toString(16);

return e.toLowerCase()

}

var a = toNumbers("f655ba9d09a112d4968c63579db590b4"),

b = toNumbers("98344c2eee86c3994890592585b49f80"),

c = toNumbers("fafd97787619720460a70e34d00aedb4");

document.cookie = "__test=" + toHex(slowAES.decrypt(c, 2, a, b)) + "; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/";

location.href = "http://gmarket.byethost5.com/json_getS.php?i=2";

也jsonlint网站显示同上述当测试PHP URL并返回该错误:

第1行

解析错误:< HTML> <体> < ^期待 'STRING', 'NUMBER', 'NULL', 'TRUE', '假', '{', '[' ,得到'undefined')

这个PHP代码,我用:

<?php

$host= "sql201.byethost5.com";

$user = "xxxxxxx";

$pass = "xxxxxxx";

$db = "xxxxxxx";

$sql="select * from customer";

$con = mysqli_connect($host,$user,$pass,$db);

$result= mysqli_query($con,$sql);

$response = array();

while ($row = mysqli_fetch_array($result))

{

array_push($response,array("name"=>$row[0],"phone"=>$row[1]));

}

echo json_encode(array("customers"=>$response));

mysqli_close($con);

?>

2016-09-29

Nawaf

+0

URL返回json。看起来问题出在Android代码 –

+0

'$ response = array(); ($ row = mysqli_fetch_array($ result)) { $ response ['customers'] [] = array(“name”=> $ row [0],“phone”=> $ row [1] ); } echo json_encode($ response);' –

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值