php调试;如何设置变量?

时间:2014-03-19 17:54:49

标签: php

我有一些调试C ++但没有使用php的经验。我有一个用于从网站下载文件的脚本。但是现在我收到以下错误,文件永远不会下载:

Notice: Undefined index: set in /Users/duboisford/Desktop/8tracks-Downloader/show.php Line 125:

Notice: Undefined index: set in /Users/duboisford/Desktop/8tracks-Downloader/show.php Line 109:

Notice: Undefined index: set in /Users/duboisford/Desktop/8tracks-Downloader/show.php Line 111:

第109行:

$song=$obj['set']['track']['track_file_stream_url']; ### FIX: changed 'url' to 'track_file_stream_url'

第111行:

echo '<tr><td><a href="'.$song.'">'.$obj['set']['track']['name'].'</a><br/>'.$obj['set']['track']['performer'].'</td></tr>';

第125行:

if($obj['set']['at_end'])

看起来问题是变量&#39;设置&#39;。但是,我没有看到文件中声明的变量。它从哪里得到这个变量?这是整个循环。

//RECURSIVELY PLAY/DOWNLOAD SONGS
$at_end=false;
while(!$at_end)
{
    $song=$obj['set']['track']['track_file_stream_url']; ### FIX: changed 'url' to 'track_file_stream_url'

    echo '<tr><td><a href="'.$song.'">'.$obj['set']['track']['name'].'</a><br/>'.$obj['set']['track']['performer'].'</td></tr>';

    //GET NEXT SONG
    $playurl= 'http://8tracks.com/sets/'.$token.'/next?mix_id='.$playlistid.'&format=jsonh&api_key=' . $api_key;

    $songcurl = curl_init($playurl);
    curl_setopt($songcurl, CURLOPT_URL,$playurl);
    curl_setopt($songcurl, CURLOPT_RETURNTRANSFER, true);
    $songdata = curl_exec($songcurl);
    curl_close($songcurl);

    $obj = json_decode($songdata,true);

    //CHECK IF AT END OF PLAYLIST
    if ($obj['set']['at_end'])
        $at_end= true;
}

0 个答案:

没有答案