获取SimpleXMLElement内容

我如何获取SimpleXMLElement的内容,这是我得到的输出

SimpleXMLElement {#292 ▼
  +"@attributes": array:1 [▶]
  +"channel": SimpleXMLElement {#1013 ▼
    +"title": "title"
    +"link": "https://link.net"
    +"description": "description"
    +"language": "en"
    +"lastBuildDate": "Sun, 05 Jul 2020 12:31:51 GMT"
    +"image": SimpleXMLElement {#607 ▶}
    +"item": array:400 [▼
      0 => SimpleXMLElement {#975 ▶}
      1 => SimpleXMLElement {#1222 ▶}
      2 => SimpleXMLElement {#1223 ▶}

what works for me is $xml->channel which gets me the content of the channel, but adding item afterwards gets me the structure of the items rather than the items themselves.

Is it possible to get the items and their content, such as $xml[0] to get me the content of the first element.

我在这里找到但没有用的解决方案之一是

$array = array();
foreach ($xml->channel->item as $item) {
  $array[] = array(
    'title'=>(string)$item->title
  );
}

但是它只是删除了属性字段!

Edit: Added the result of $xml->channel->item

SimpleXMLElement {#1169 ▼
  +"title": SimpleXMLElement {#975}
  +"link": SimpleXMLElement {#1222}
  +"guid": SimpleXMLElement {#1223 ▶}
  +"pubDate": SimpleXMLElement {#1224}
... (other columns)
}