Php 我试图把标题,但它完全

Php 我试图把标题,但它完全,php,Php,您可能需要使用,即: 如果您只需要第一个标题,可以使用: $url = "https://www.ethnews.com/rss.xml"; $feed = simplexml_load_file($url); foreach($feed->channel->item as $story) { echo $story->title; # other options : # echo $story->desc; # echo $story

您可能需要使用,即:


如果您只需要第一个标题,可以使用:

$url = "https://www.ethnews.com/rss.xml";
$feed = simplexml_load_file($url);

foreach($feed->channel->item as $story) {
    echo $story->title;
    # other options :
    # echo $story->desc;
    # echo $story->link;
    # echo $story->date;
}

对不起标题…我试图回应这个rss提要,但它完全是什么?
$url = "https://www.ethnews.com/rss.xml";
$feed = simplexml_load_file($url);

foreach($feed->channel->item as $story) {
    echo $story->title;
    # other options :
    # echo $story->desc;
    # echo $story->link;
    # echo $story->date;
}
$url = "https://www.ethnews.com/rss.xml";
$feed = simplexml_load_file($url);
echo $feed->channel->item[0]->title;