我有一个每日更新的来源(这不是你在我的代码中找到的fixtures.php,这非常重要!)关于足球信息。我想在现有的简单html dom查询中添加一些数据。
数据来源的样本:
var info = new Array();
info[0] = new Array('','England','','League One','BARNSLEY',35,4.9,23.6,67,181,'',36,'CHESTERFIELD',2.8,25.3,11,184,'',36,22,'','',28,2,4,0,4,3,3,1,4,3,4,2,0,7,2,3,3,2,2,0,0,3,0,1,3,1,3,3,5,2,5,' 11','6 ',55,25,25,30,30,30,4,2,1,2,2,2,2,3,2,3,2,2,3,2,2,2,2,2,2,2,2,2,1,2); info[1] = new Array('','Austria','','Bundesliga','WIENER NEUSTADT',213,6.0,25.2,34,181,'',30,'RIED',8.9,24.0,38,182,'',42,28,'','',28,3,0,2,1,2,0,4,4,0,3,2,1,4,3,5,2,0,3,0,2,3,0,3,0,3,1,3,5,2,5,' 9','6 ',30,30,30,30,30,35,2,2,2,2,2,2,2,2,0,2,2,2,1,2,2,1,2,2,3,2,2,1,2,2);info[2] = new Array('','England','','League One','DONCASTER',273,5.6,26.6,50,181,'',41,'ROCHDALE',3.4,25.3,23,182,'',31,27,'','',28,4,2,3,2,0,4,3,0,4,0,1,0,5,2,5,2,4,1,3,2,1,1,1,1,3,0,1,3,2,7,' 12','7 ',35,30,25,35,30,30,2,2,3,3,3,3,3,2,3,2,3,2,2,2,2,2,2,2,2,2,2,2,2,2); info[3] = new Array('','England','','League One','GILLINGHAM',342,2.4,24.3,32,182,'',33,'BRADFORD',6.1,27.1,41,181,'',39,27,'','',28,3,1,0,0,4,3,4,4,1,2,2,1,5,2,5,4,2,1,4,2,4,1,0,2,2,0,4,4,4,4,' 14','9 ',30,30,35,30,30,30,2,2,1,1,2,2,1,2,2,2,2,2,1,1,2,1,2,1,2,2,1,2,2,1);
我现有的简单html dom查询(使用另一个包含带足球装置的简单html dom表的php源码)。
<?php
include ("mysql.php");
include_once('simple_html_dom.php');
ini_set('display_errors', true);
error_reporting(E_ALL);
$html = file_get_html('fixtures.php');
class fixtures {
var $matchday;
var $kickofftime;
var $hometeam;
var $awayteam;
function fixtures ($matchday, $kickofftime, $hometeam, $awayteam){
$this->matchday=$matchday;
$this->kickofftime=$kickofftime;
$this->hometeam=$hometeam;
$this->awayteam=$awayteam;
return $this;
}
}
$i=0;
$matchday=$html->find('h1',0);
$matchday->plaintext;
foreach($html->find('table.fixtures') as $fixtures)
{
foreach ($fixtures->find('tr[class=white],tr[class=grey]') as $fixturesTR) {
$kickofftime=$fixturesTR->find('td[class=a1],td[class=a2]',0)->plaintext;
$hometeam=$fixturesTR->find('td[class=ht]')->plaintext;
$awayteam=$fixturesTR->find('td[class=at]')->plaintext;
$i++;
echo $kickofftime;
echo $hometeam;
echo $awayteam;
}
}
?>
我的问题:如何更新现有的简单html dom查询? (我想将两个来源一起使用,这非常重要)。
我现有的简单html dom查询结果:
1988-12-11 18:00 Barnsley Chesterfield
1988-12-13 16:00 Wiener Neustadt Ried
1988-12-12 20:15 Doncaster Rochdale
1988-12-12 21:15 Gillingham Bradford
。 .. ...
我想要这个结果:
1988-12-11 18:00 Barnsley 11 181 Chesterfield 6 184 England League One 35
1988-12-13 16:00 Wiener Neustadt 9 181 Ried 6 182 Austria Bundesliga 213
1988-12-12 20:15 Doncaster 12 181 Rochdale 7 182 England League One 273
1988-12-12 21:15 Gillingham 14 182 Bradford 9 181 England League One 342
感谢。 (对不起,我再问一次,但这非常重要)。