我有这个代码用于从表中抓取团队名称
$url = 'http://fantasy.premierleague.com/my-leagues/303/standings/';
$html = @file_get_html($url);
//Cut out the table
$FullTable = $html->find('table[class=ismStandingsTable]',0);
//get the text from the 3rd cell in the row
$teamname = $FullTable->find('td',2)->innertext;
echo $teamname;
这很有效..并给出了这个输出....
<a href="/entry/110291/event-history/33/">Why Always Me?</a>
但是当我添加这些行时..
$teamdetails = $teamname->find('a')->href;
echo $teamdetails;
我得到完全空白的输出。
知道为什么吗?我正在尝试将/entry/110291/event-history/33/
as 作为一个变量,并将 theWhy Always Me?
作为另一个变量。