时间:2021-07-01 10:21:17 帮助过:3人阅读
";print_r($data);exit();
return $data;
}
在浏览器里找打开连接是这样的。
SINAFINANCE132436359014192800(({data:[{og_id:"1061971",contest_id:"8",sid:"2096647540",StockCode:"sz002230",StockName:"科大讯飞",SellBuy:"0",OrderPrice:"34.700",DealAmount:"4200",OrderAmount:"4200",IfDealt:"1",OrderTime:"2011-10-25 09:58:44",mtime:"2011-10-25 09:58:44",remark:""}],count:"100"}))
------解决方案--------------------
你这个不是json来的
------解决方案--------------------
这是jsonp
------解决方案--------------------
http://api.jquery.com/jQuery.getJSON/
------解决方案--------------------
本帖最后由 xuzuning 于 2011-12-21 10:33:58 编辑 1、不知道你的这个串是从哪里来的,因为你没给出出处
2、不知道什么是 jsonp,但此串显然不符合那个连接中的描述
3、但我知道这是一个js指令,他通过先前已加载过的 SINAFINANCE132436359014192800 函数进行某个操作。
4、我还知道,传递的 json 串是微软系列语言使用的标准格式:键名没有双引号
这种格式的 json 不能被目前 php 的内置函数所接受,不能不说是个败笔
js 分析显示
og_id:1061971
contest_id:8
sid:2096647540
StockCode:sz002230
StockName:科大讯飞
SellBuy:0
OrderPrice:34.700
DealAmount:4200
OrderAmount:4200
IfDealt:1
OrderTime:2011-10-25 09:58:44
mtime:2011-10-25 09:58:44
remark:
remark:undefined
remark:undefined
count:100
php 分析$s =<<< JSON显示
{data:[{og_id:"1061971",contest_id:"8",sid:"2096647540",StockCode:"sz002230",StockName:"科大讯飞",SellBuy:"0",OrderPrice:"34.700",DealAmount:"4200",OrderAmount:"4200",IfDealt:"1",OrderTime:"2011-10-25 09:58:44",mtime:"2011-10-25 09:58:44",remark:""}],count:"100"}
JSON;
$s = iconv('gbk', 'utf-8', $s);
$s = preg_replace('/(\w+[a-z]):/i', '"$1":', $s);
print_r(json_decode($s));
stdClass Object
(
[data] => Array
(
[0] => stdClass Object
(
[og_id] => 1061971
[contest_id] => 8
[sid] => 2096647540