更新时间:2022-03-03 09:28:15
使用 DOM 解析器,如 SimpleXML 将 HTML 代码拆分为节点,并遍历节点构建数组.
Use a DOM parser like SimpleXML to split the HTML code into nodes, and walk through the nodes to build the array.
对于损坏/无效的 HTML,SimpleHTMLDOM 更宽松(但它不是内置的).
For broken/invalid HTML, SimpleHTMLDOM is more lenient (but it's not built in).