我已经抓取了一些javascript(使用simple_html_dom),这就是我想出的......
$MyScrape的内容
<script type="text/javascript">
var initialInfo = [
[
[29, 30, 'bb1', 'bb2', '02/15/2013 20:00:00', '02/15/2013 00:00:00', 6, 'AT', '1 : 1', '2 : 3', , , '2 : 3'],
[
[29, 'bb1', 6.91, [
[
['pears', [4]],
['kiwis', [20]]
]
],
[
[36849, 'abcdefg', 6.24, [
[
['apples', [3]],
['oranges', [0]]
]
], 5, 'iff', 29, 2, 88, 'abc', 23, 180, 76]
],
['4231', [
[5, 1],
[7, 7]
]]
]
]
], 0
];
</script>
我正在尝试获取initialInfo
PHP 变量的内容,以便可以执行此操作....
$str = ????;
$jsonarray = json_decode($str, true);
foreach($jsonarray as $row)
{
$id = $row[0][0]; //29
$tc = $row[0][1]; //30
$ab = $row[0][2]; //bb1
}
任何人都知道我该怎么做(最好简单)?