php json andriod 问题 你的 $json_string 表示的是单个对象变成数组就:echo "[$json_string]"; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 ---------- JAVA ----------Exception in thread "main" net.sf.json.JSONException: A JSONArray text must start with '[' at character 1 of <?xml version="1.0" encoding="utf-8"?><html><head><meta http-equiv="Content-Type" content="text/html; charset=GBK"><title>鎴戠殑鍥㈣喘</title><meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black"><meta name="format-detection" content="telephone=no"><link href="source/plugin/dzapp_vip/template/touch/image/card.css" rel="stylesheet" type="text/css"></head><body id="cardpower" onload="new Accordian('basic-accordian',2,'header_highlight');" class="mode_webapp" style=""><div class="menu_header"> <div class="menu_topbar"> <strong class="head-title">楠岃瘉</strong> <span class="head_btn_left"><a href="javascript:history.go(-1);"><span>杩斿洖</span></a><b></b></span> <a class="head_btn_right" href="plugin.php?id=dzapp_shop&mobile=2"><span><i class="menu_header_home"></i></span><b></b> </a> </div></div> <div class="qiandaobanner"> <a href="javascript:;"><img src="source/plugin/dzapp_vip/template/touch/image/vippower.jpg"></a> </div><div id="basic-accordian"> <div id="test0-header" class="accordion_headings header_highlight"><div class="tab vip "><span class="title"><p>鏈夋晥鏈燂細1970-01-01 鑷?1970-01-01</p></span></div><div id="test0-content" style="display: block; overflow: hidden; opacity: 1; height: auto;"><div class="accordion_child"><p class="num "> </p><div><form name="checkform" method="post" autocomplete="off" action="plugin.php?id=dzapp_tuan&mod=check"><input type="hidden" name="formhash" value="18155c5b" /><input type="hidden" name="checksubmit" value="true" /><input type="hidden" name="code_id" value="" /><input type="hidden" name="code" value="" /><input type="hidden" name="uid" value="" /><p style=" margin:10px 0 0 0"><input name="tuan_password" class="px" id="tuan_password" type="password" placeholder="楠岃瘉鍥㈣喘瀵嗙爜" ></p> <p style=" margin:10px 0"><button type="submit" class="submit">鎻愪氦</button></p></div></form></div> </div></div> </div><style type="text/css">body { margin-bottom:60px !important; }a, button, input { -webkit-tap-highlight-color:rgba(255, 0, 0, 0); }ul, li { list-style:none; margin:0; padding:0 }.top_bar { position: fixed; z-index: 900; bottom: 0; left: 0; right: 0; margin: auto; font-family: Helvetica, Tahoma, Arial, Microsoft YaHei, sans-serif; }.top_menu { display:-webkit-box; border-top: 1px solid #3D3D46; display: block; width: 100%; background: rgba(255, 255, 255, 0.7); height: 48px; display: -webkit-box; display: box; margin:0; padding:0; -webkit-box-orient: horizontal; background: -webkit-gradient(linear, 0 0, 0 100%, from(#524945), to(#48403c), color-stop(60%, #524945)); box-shadow: 0 1px 0 0 rgba(255, 255, 255, 0.1) inset; }.top_bar .top_menu>li { -webkit-box-flex:1; position:relative; text-align:center; }.top_menu li:first-child { background:none; }.top_bar .top_menu>li>a { height:48px; margin-right: 1px; display:block; text-align:center; color:#FFF; text-decoration:none; text-shadow: 0 1px rgba(0, 0, 0, 0.3); -webkit-box-flex:1; }.top_bar .top_menu>li.home { max-width:70px }.top_bar .top_menu>li.home a { height: 66px; width: 66px; margin: auto; border-radius: 60px; position: relative; top: -22px; left: 2px; background: url(source/plugin/dzapp_shop/static/image/foot/KRRvB8Lure.png) no-repeat center center; background-size: 100% 100%; }.top_bar .top_menu>li>a label { overflow:hidden; margin: 0 0 0 0; font-size: 12px; display: block !important; line-height: 18px; text-align: center; }.top_bar .top_menu>li>a img { padding: 3px 0 0 0; height: 24px; width: 24px; color: #fff; line-height: 48px; vertical-align:middle; }.top_bar li:first-child a { display: block; }.menu_font { text-align:left; position:absolute; right:10px; z-index:500; background: -webkit-gradient(linear, 0 0, 0 100%, from(#524945), to(#48403c), color-stop(60%, #524945)); border-radius: 5px; width: 120px; margin-top: 10px; padding: 0; box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3); }.menu_font.hidden { display:none; }.menu_font { top:inherit !important; bottom:60px; }.menu_font li a { height:40px; margin-right: 1px; display:block; text-align:center; color:#FFF; text-decoration:none; text-shadow: 0 1px rgba(0, 0, 0, 0.3); -webkit-box-flex:1; }.menu_font li a { text-align: left !important; }.top_menu li:last-of-type a { background: none; overflow:hidden; }.menu_font:after { top: inherit!important; bottom: -6px; border-color: #48403c rgba(0, 0, 0, 0) rgba(0, 0, 0, 0); border-width: 6px 6px 0; position: absolute; content: ""; display: inline-block; width: 0; height: 0; border-style: solid; left: 80%; }.menu_font li { border-top: 1px solid rgba(255, 255, 255, 0.1); border-bottom: 1px solid rgba(0, 0, 0, 0.2); }.menu_font li:first-of-type { border-top: 0; }.menu_font li:last-of-type { border-bottom: 0; }.menu_font li a { height: 40px; line-height: 40px !important; position: relative; color: #fff; display: block; width: 100%; text-indent: 10px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }.menu_font li a img { width: 20px; height:20px; display: inline-block; margin-top:-2px; color: #fff; line-height: 40px; vertical-align:middle; }.menu_font>li>a label { padding:3px 0 0 3px; font-size:14px; overflow:hidden; margin: 0; }#menu_list0 { right:0; left:10px; }#menu_list0:after { left: 20%; }#sharemcover { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); display: none; z-index: 20000; }#sharemcover img { position: fixed; right: 18px; top: 5px; width: 260px; height: 180px; z-index: 20001; border:0; }.top_bar .top_menu>li>a:hover, .top_bar .top_menu>li>a:active { background-color:#333; }.menu_font li a:hover, .menu_font li a:active { background-color:#333; }.menu_font li:first-of-type a { border-radius:5px 5px 0 0; }.menu_font li:last-of-type a { border-radius:0 0 5px 5px; }#plug-wrap { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0); z-index:800; }#cate18 .device {bottom: 49px;}#cate18 #indicator {bottom: 240px;}#cate19 .device {bottom: 49px;}#cate19 #indicator {bottom: 330px;}#cate19 .pagination {bottom: 60px;}</style><script src="source/plugin/dzapp_shop/template/js/zepto.min.v39.js" type="text/javascript"></script><script src="source/plugin/dzapp_shop/template/js/hippo2.min.v75.js" type="text/javascript"></script><script src="source/plugin/dzapp_shop/template/js/base.min.v39.js" type="text/javascript"></script><script type="text/javascript">(function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = 'source/plugin/dzapp_shop/template/js/ga.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);})();</script><script type="text/javascript">$(document).ready(function(){DP.app.enterComputer();DP.reDomain = '';});</script><script src="source/plugin/dzapp_shop/template/js/slide.min.v8.js" type="text/javascript"></script><script type="text/javascript">$(document).ready(function(){DP.app.newSwitchCity();DP.app.slideHeader();DP.app.initDeskScreen();_gaq.push(['_trackPageview', '/wapm/home/tuan']);_gaq.push(['_trackPageview', '/wapm/home/pro']);_gaq.push(['_trackPageview', '/wapm/home/locate_f']);_gaq.push(['_trackPageview', '/wapm/home/rank']);DP.app.initHomeSearch();DP.isIndex = true;DP.isBSG = true;});</script><script type="text/javascript">(function(){var onBridgeReady = function () {var appId = '';WeixinJSBridge.on('menu:share:appmessage', function(argv){WeixinJSBridge.invoke('sendAppMessage',{"appid" : appId,"img_url" : '',"img_width" : "640","img_height" : "640","link" : '',"desc" : '',"title" : ''}, function(res) {})});WeixinJSBridge.on('menu:share:timeline', function(argv){WeixinJSBridge.invoke('shareTimeline',{"img_url" : '',"img_width" : "640","img_height" : "640","link" : '',"desc" : '',"title" : ''}, function(res) {});});};if(document.addEventListener){document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);} else if(document.attachEvent){document.attachEvent('WeixinJSBridgeReady' , onBridgeReady);document.attachEvent('onWeixinJSBridgeReady' , onBridgeReady);}})();</script></body></html> at net.sf.json.util.JSONTokener.syntaxError(JSONTokener.java:499) at net.sf.json.JSONArray._fromJSONTokener(JSONArray.java:1116) at net.sf.json.JSONArray._fromString(JSONArray.java:1197) at net.sf.json.JSONArray.fromObject(JSONArray.java:127) at net.sf.json.JSONArray.fromObject(JSONArray.java:105) at print.main(print.java:16)输出完成 (耗时 1 秒) - 正常终止 java还是报错 Exception in thread "main" net.sf.json.JSONException: A JSONArray text must start with '[' at character 1 of 还是必须以[开头 你的 php 文件有 BOM 头吧? 所有相关的文件都要去掉 BOM 头 我记得那个json好像分两个版本一个叫什么json-n一个叫什么json-p的吧实在不行就自己拿PHP写一个编码的 看这段,你的服务器没有输出JSON格式的数据,而是一段HTML 和android的json数据传输没有发现android有无法解析的问题... 楼主的地址写错了吧,这个地址http://www.ltuanzhang.com/plugin.php?id=dzapp_tuan&mod=check是html不是json哦 关于安全性的一些疑问 紧急,疑难: php调用java,jdbc 点击图放大的功能 【菜鸟问题】&&的用法 请教:file_get_contents("D:\PHP\www\caiji\ftemp\1.htm") 为何出路径出错? PHP的 DOMDocument 遇到的小问题 求救,大家帮帮我,网页编码的问题 求PHP写个超简单的发送邮件的代码。。。。。。。。。。 Fatal error怎么解决的啊 为什么我的下载总不能成功,在线等~~急 网站所有链接被指向到首页是什么情况 - - 如何判断一个多维数组里面的值是否都为空?
Exception in thread "main" net.sf.json.JSONException: A JSONArray text must start with '[' at character 1 of <?xml version="1.0" encoding="utf-8"?><html><head><meta http-equiv="Content-Type" content="text/html; charset=GBK"><title>鎴戠殑鍥㈣喘</title><meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black"><meta name="format-detection" content="telephone=no"><link href="source/plugin/dzapp_vip/template/touch/image/card.css" rel="stylesheet" type="text/css"></head><body id="cardpower" onload="new Accordian('basic-accordian',2,'header_highlight');" class="mode_webapp" style=""><div class="menu_header"> <div class="menu_topbar"> <strong class="head-title">楠岃瘉</strong> <span class="head_btn_left"><a href="javascript:history.go(-1);"><span>杩斿洖</span></a><b></b></span> <a class="head_btn_right" href="plugin.php?id=dzapp_shop&mobile=2"><span><i class="menu_header_home"></i></span><b></b> </a> </div></div> <div class="qiandaobanner"> <a href="javascript:;"><img src="source/plugin/dzapp_vip/template/touch/image/vippower.jpg"></a> </div><div id="basic-accordian"> <div id="test0-header" class="accordion_headings header_highlight"><div class="tab vip "><span class="title"><p>鏈夋晥鏈燂細1970-01-01 鑷?1970-01-01</p></span></div><div id="test0-content" style="display: block; overflow: hidden; opacity: 1; height: auto;"><div class="accordion_child"><p class="num "> </p><div><form name="checkform" method="post" autocomplete="off" action="plugin.php?id=dzapp_tuan&mod=check"><input type="hidden" name="formhash" value="18155c5b" /><input type="hidden" name="checksubmit" value="true" /><input type="hidden" name="code_id" value="" /><input type="hidden" name="code" value="" /><input type="hidden" name="uid" value="" /><p style=" margin:10px 0 0 0"><input name="tuan_password" class="px" id="tuan_password" type="password" placeholder="楠岃瘉鍥㈣喘瀵嗙爜" ></p> <p style=" margin:10px 0"><button type="submit" class="submit">鎻愪氦</button></p></div></form></div> </div></div> </div><style type="text/css">body { margin-bottom:60px !important; }a, button, input { -webkit-tap-highlight-color:rgba(255, 0, 0, 0); }ul, li { list-style:none; margin:0; padding:0 }.top_bar { position: fixed; z-index: 900; bottom: 0; left: 0; right: 0; margin: auto; font-family: Helvetica, Tahoma, Arial, Microsoft YaHei, sans-serif; }.top_menu { display:-webkit-box; border-top: 1px solid #3D3D46; display: block; width: 100%; background: rgba(255, 255, 255, 0.7); height: 48px; display: -webkit-box; display: box; margin:0; padding:0; -webkit-box-orient: horizontal; background: -webkit-gradient(linear, 0 0, 0 100%, from(#524945), to(#48403c), color-stop(60%, #524945)); box-shadow: 0 1px 0 0 rgba(255, 255, 255, 0.1) inset; }.top_bar .top_menu>li { -webkit-box-flex:1; position:relative; text-align:center; }.top_menu li:first-child { background:none; }.top_bar .top_menu>li>a { height:48px; margin-right: 1px; display:block; text-align:center; color:#FFF; text-decoration:none; text-shadow: 0 1px rgba(0, 0, 0, 0.3); -webkit-box-flex:1; }.top_bar .top_menu>li.home { max-width:70px }.top_bar .top_menu>li.home a { height: 66px; width: 66px; margin: auto; border-radius: 60px; position: relative; top: -22px; left: 2px; background: url(source/plugin/dzapp_shop/static/image/foot/KRRvB8Lure.png) no-repeat center center; background-size: 100% 100%; }.top_bar .top_menu>li>a label { overflow:hidden; margin: 0 0 0 0; font-size: 12px; display: block !important; line-height: 18px; text-align: center; }.top_bar .top_menu>li>a img { padding: 3px 0 0 0; height: 24px; width: 24px; color: #fff; line-height: 48px; vertical-align:middle; }.top_bar li:first-child a { display: block; }.menu_font { text-align:left; position:absolute; right:10px; z-index:500; background: -webkit-gradient(linear, 0 0, 0 100%, from(#524945), to(#48403c), color-stop(60%, #524945
)); border-radius: 5px; width: 120px; margin-top: 10px; padding: 0; box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3); }.menu_font.hidden { display:none; }.menu_font { top:inherit !important; bottom:60px; }.menu_font li a { height:40px; margin-right: 1px; display:block; text-align:center; color:#FFF; text-decoration:none; text-shadow: 0 1px rgba(0, 0, 0, 0.3); -webkit-box-flex:1; }.menu_font li a { text-align: left !important; }.top_menu li:last-of-type a { background: none; overflow:hidden; }.menu_font:after { top: inherit!important; bottom: -6px; border-color: #48403c rgba(0, 0, 0, 0) rgba(0, 0, 0, 0); border-width: 6px 6px 0; position: absolute; content: ""; display: inline-block; width: 0; height: 0; border-style: solid; left: 80%; }.menu_font li { border-top: 1px solid rgba(255, 255, 255, 0.1); border-bottom: 1px solid rgba(0, 0, 0, 0.2); }.menu_font li:first-of-type { border-top: 0; }.menu_font li:last-of-type { border-bottom: 0; }.menu_font li a { height: 40px; line-height: 40px !important; position: relative; color: #fff; display: block; width: 100%; text-indent: 10px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }.menu_font li a img { width: 20px; height:20px; display: inline-block; margin-top:-2px; color: #fff; line-height: 40px; vertical-align:middle; }.menu_font>li>a label { padding:3px 0 0 3px; font-size:14px; overflow:hidden; margin: 0; }#menu_list0 { right:0; left:10px; }#menu_list0:after { left: 20%; }#sharemcover { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); display: none; z-index: 20000; }#sharemcover img { position: fixed; right: 18px; top: 5px; width: 260px; height: 180px; z-index: 20001; border:0; }.top_bar .top_menu>li>a:hover, .top_bar .top_menu>li>a:active { background-color:#333; }.menu_font li a:hover, .menu_font li a:active { background-color:#333; }.menu_font li:first-of-type a { border-radius:5px 5px 0 0; }.menu_font li:last-of-type a { border-radius:0 0 5px 5px; }#plug-wrap { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0); z-index:800; }#cate18 .device {bottom: 49px;}#cate18 #indicator {bottom: 240px;}#cate19 .device {bottom: 49px;}#cate19 #indicator {bottom: 330px;}#cate19 .pagination {bottom: 60px;}</style><script src="source/plugin/dzapp_shop/template/js/zepto.min.v39.js" type="text/javascript"></script><script src="source/plugin/dzapp_shop/template/js/hippo2.min.v75.js" type="text/javascript"></script><script src="source/plugin/dzapp_shop/template/js/base.min.v39.js" type="text/javascript"></script><script type="text/javascript">(function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = 'source/plugin/dzapp_shop/template/js/ga.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);})();</script><script type="text/javascript">$(document).ready(function(){DP.app.enterComputer();DP.reDomain = '';});</script><script src="source/plugin/dzapp_shop/template/js/slide.min.v8.js" type="text/javascript"></script><script type="text/javascript">$(document).ready(function(){DP.app.newSwitchCity();DP.app.slideHeader();DP.app.initDeskScreen();_gaq.push(['_trackPageview', '/wapm/home/tuan']);_gaq.push(['_trackPageview', '/wapm/home/pro']);_gaq.push(['_trackPageview', '/wapm/home/locate_f']);_gaq.push(['_trackPageview', '/wapm/home/rank']);DP.app.initHomeSearch();DP.isIndex = true;DP.isBSG = true;});</script><script type="text/javascript">(function(){var onBridgeReady = function () {var appId = '';WeixinJSBridge.on('menu:share:appmessage', function(argv){WeixinJSBridge.invoke('sendAppMessage',{"appid" : appId,"img_url" : '',"img_width" : "640","img_height" : "640","link" : '',"desc" : '',"title" : ''}, function(res) {})});WeixinJSBridge.on('menu:share:timeline', function(argv){WeixinJSBridge.invoke('shareTimeline',{"img_url" : '',"img_width" : "640","img_height" : "640","link" : '',"desc" : '',"title" : ''}, function(res) {});});};if(document.addEventListener){document.addEventListener(
'WeixinJSBridgeReady', onBridgeReady, false);} else if(document.attachEvent){document.attachEvent('WeixinJSBridgeReady' , onBridgeReady);document.attachEvent('onWeixinJSBridgeReady' , onBridgeReady);}})();</script></body></html>
at net.sf.json.util.JSONTokener.syntaxError(JSONTokener.java:499)
at net.sf.json.JSONArray._fromJSONTokener(JSONArray.java:1116)
at net.sf.json.JSONArray._fromString(JSONArray.java:1197)
at net.sf.json.JSONArray.fromObject(JSONArray.java:127)
at net.sf.json.JSONArray.fromObject(JSONArray.java:105)
at print.main(print.java:16)输出完成 (耗时 1 秒) - 正常终止 java还是报错
实在不行就自己拿PHP写一个编码的
看这段,你的服务器没有输出JSON格式的数据,而是一段HTML
http://www.ltuanzhang.com/plugin.php?id=dzapp_tuan&mod=check
是html不是json哦