PHP警告:main():节点不再存在

时间:2015-03-01 18:11:29

标签: php

我有时会在我的日志文件中收到此错误消息。

  

01.03.2015 18:43:04 [client 87.177.90.0] PHP警告:main():第108行的*****.php中不再存在节点

第108行是:

$genre_id = $category_id['im']['id'];

我尝试了几种方法来检查节点是否可用,但它没有完成。任何人都可以帮我吗?

$Kategorien = simplexml_load_file('http://itunes.apple.com/de/rss/topsongs/limit=10/explicit=true/xml');

foreach ($Kategorien->entry as $item) {
    $id =  $item->id;
    $title = $item->title;
    $preview = $item->link[1]["href"];
    $namespaces = $item->getNameSpaces(true);
    $im = $item->children($namespaces['im']);
    $track_title =  $im->name;
    $track_artist = $im->artist;
    $track_amount = $im->price->attributes()->amount;
    $track_currency = $im->price->attributes()->currency;
    $release_date =  $im->releaseDate;
    $image =  $im->image[2];
    $entry_id['im'] = $item->id->attributes('im', TRUE);
    $track_id =  $entry_id['im']['id'];
    $category_id['im'] = $item->category->attributes('im', TRUE);
    $genre_id = $category_id['im']['id'];
    $genre_cat =  $item->category->attributes()->term;

}

我试过这种方式,但没有任何成功。我的错误在哪里?

foreach ($Kategorien->entry as $item) {
    $id =  $item->id;
    $title = $item->title;
    $preview = $item->link[1]["href"];
    $namespaces = $item->getNameSpaces(true);
    $im = $item->children($namespaces['im']);
    $track_title =  $im->name;
    $track_artist = $im->artist;
    $track_amount = $im->price->attributes()->amount;
    $track_currency = $im->price->attributes()->currency;
    $release_date =  $im->releaseDate;
    $image =  $im->image[2];
    $entry_id['im'] = $item->id->attributes('im', TRUE);
    $track_id =  $entry_id['im']['id'];
    $category_id['im'] = $item->category->attributes('im', TRUE);

if (isset($category_id['im']['id'])) {

    $genre_id = $category_id['im']['id'];
    $genre_cat =  $item->category->attributes()->term;
}
}

0 个答案:

没有答案