For example, we have this string:
"<span>some text</span><someInVaLIDTAG>some text</someInVaLIDTAG_CLOSED_NOT_PROPERLY><p attr='value'>Text</p>"
I nedd to get all tags in array like this:
[<span>, </span>, <someInVaLIDTAG>, </someInVaLIDTAG_CLOSED_NOT_PROPERLY>, <p>, </p>]
and if there is some tags like i will just replace all strange tags with valid ones:
<someInVaLIDTAG> -> <p>
</someInVaLIDTAG_CLOSED_NOT_PROPERLY> -> </p>
Try using DOMDocument. See the documentation here . You can search about DOMDocument example in Stack Overflow.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.