PHP way of parsing HTML string

前端 未结 3 1937
时光取名叫无心
时光取名叫无心 2021-01-18 08:28

I have a php string that contains the below HTML I am retrieving from an RSS feed. I am using simple pie and cant find any other way of splitting these two datasets it gets

3条回答
  •  时光说笑
    2021-01-18 09:17

    Try Simple HTML Dom Parser

    // Create DOM from HTML string
    $html = str_get_html('Your HTML here');
    
    // Find all images 
    foreach($html->find('img') as $element) 
           echo $element->src . '
    '; // Description $description = $html->find('div[style=example]');

提交回复
热议问题