PHP - split a string of HTML attributes into an indexed array

后端 未结 6 852
后悔当初
后悔当初 2020-12-11 16:20

I\'ve got a string with HTML attributes:

$attribs = \' id= \"header \" class = \"foo   bar\" style =\"background-color:#fff; color: red; \"\';
6条回答
  •  温柔的废话
    2020-12-11 16:57

    May be this helps you .. What it does ..

    • A HTML DOM parser written in PHP5+ let you manipulate HTML in a very easy way!
    • Require PHP 5+.
    • Supports invalid HTML.
    • Find tags on an HTML page with selectors just like jQuery.
    • Extract contents from HTML in a single line.

    http://simplehtmldom.sourceforge.net/

提交回复
热议问题