SimpleXML keeps returning content on CDATA element

后端 未结 2 1982
误落风尘
误落风尘 2021-01-26 10:15

So another CDATA returning content question. I\'ve seen many answers, but even though I tried them all, I still get only content.

In more details:

I have an xml

2条回答
  •  故里飘歌
    2021-01-26 10:40

    For element names which cannot be PHP identifiers (like body.content), you must use an alternative PHP notation:

    $element->NewsComponent->ContentItem->DataContent->body->{'body.content'};
    

提交回复
热议问题