20,359
社区成员
发帖
与我相关
我的任务
分享
$url = 'http://home.flashdata2.jrj.com.cn/limitStatistic/dtForce/20190724.js';
$check = file_get_contents($url);
$result = '{"test":[' . trim(trim(substr($check, strripos($check, "Data") + 7), ']};')) . ']}';
echo $result;
var_dump(json_decode($result, true));exit;
var yzb_dtForce={"summary":{size:1,time:"2019-07-24 15:59:55"}, "column":{stockcode:0,stockname:1,nowPrice:2,priceLimit:3,fcb:4,flb:5,fdMoney:6,firstZtTime:7,lastZtTime:8,opentime:9,zhenfu:10,force : 11}, "Data":[["600485","*ST新海",9.2,-4.96,5182.805,0.18929227,3.15653555E9,"09:25:04","09:25:04",0,0.0,100.0] ]};
{"test":[["600485","*ST 新海",9.2,-4.96,5182.805,0.18929227,3.15653555E9,"09:25:04","09:25:04",0,0.0,100.0]]}
$check = file_get_contents('php://input');
var_dump(json_decode($check, true));exit;
array (size=1)
'test' =>
array (size=1)
0 =>
array (size=12)
0 => string '600485' (length=6)
1 => string '*ST 新海' (length=15)
2 => float 9.2
3 => float -4.96
4 => float 5182.805
5 => float 0.18929227
6 => float 3156535550
7 => string '09:25:04' (length=8)
8 => string '09:25:04' (length=8)
9 => int 0
10 => float 0
11 => float 100
//location.php内容 跳转到test.php
<script src="http://home.flashdata2.jrj.com.cn/limitStatistic/dtForce/20190724.js"></script>
<script>
var yzb_dtForce = JSON.stringify(yzb_dtForce);
console.log(yzb_dtForce);
window.location.href="test.php?yzb_dtForce="+yzb_dtForce
</script>
//test.php 接收get参数
<?php
$yzb_dtForce = $_GET['yzb_dtForce'];
print_r( json_decode($yzb_dtForce,true));
//Array ( [summary] => Array ( [size] => 1 [time] => 2019-07-24 15:59:55 ) [column] => Array ( [stockcode] => 0 [stockname] => 1 [nowPrice] => 2 [priceLimit] => 3 [fcb] => 4 [flb] => 5 [fdMoney] => 6 [firstZtTime] => 7 [lastZtTime] => 8 [opentime] => 9 [zhenfu] => 10 [force] => 11 ) [Data] => Array ( [0] => Array ( [0] => 600485 [1] => *ST信威 [2] => 9.2 [3] => -4.96 [4] => 5182.805 [5] => 0.18929227 [6] => 3156535550 [7] => 09:25:04 [8] => 09:25:04 [9] => 0 [10] => 0 [11] => 100 ) ) )