0

我在一些逻辑上遇到了一些问题,这些逻辑适用于一组参数但不适用于另一组参数。

我的代码是

$data = simplexml_load_file("http://api.fantasyfootballnerd.com/ffnScheduleXML.php?apiKey={Your key here}");

$date = 1;
$dateTest = 0;
$gameTimeTest = 0;
$gameTime = 1;
foreach($data->Schedule->Game as $game)
{

    if($game->attributes()->Week == $_GET['week'])
    {

        if($date==$dateTest)
        {
            echo "\r"; 
        }else {
            echo date('l, F jS', strtotime($date))."\r\n";
        }

        if ($gameTimeTest==$gameTime)
        {    
            echo "\r"; 
        } else{
            echo date("g:i A",strtotime($gameTime));    
        }
        $gameTimeTest = $gameTime;
        $dateTest = $date;
        echo  $game->attributes()->AwayTeam." at ".$game->attributes()->HomeTeam."\r\n";

        $date = $game->attributes()->GameDate;
        $gameTime = $game->attributes()->GameDate.' '.$game->attributes()->GameTime;

    }   
} 

现在检查时间的部分可以正常工作,但日期部分无论如何都会不断地吐出日期。

4

0 回答 0