PHP DOMDocument how to get element?

前端 未结 2 525
醉梦人生
醉梦人生 2021-01-25 02:48

I am trying to read a website\'s content but i have a problem i want to get images, links these elements but i want to get elements them selves not the element content for insta

2条回答
  •  野性不改
    2021-01-25 03:13

    I'm assuming you just copy-pasted some example code and didn't bother trying to learn how it actually works...

    Anyway, the ->nodeValue part takes the element and returns the text content (because the element has a single text node child - if it had anything else, I don't know what nodeValue would give).

    So, just remove the ->nodeValue and you have your element.

提交回复
热议问题