tag and its content from HTML using php-第2页回答 - 易学问答
tag and its content from HTML using php
Below is the text I need to remove tags from
Addiction, stress and subjective wellbeing The need and signi
Addiction, stress and subjective wellbeing
The need and signi
This code removes one p-tag:
function parse($html) { $dom = new DOMDocument(); @$dom->loadHTML($html); $ps = $dom->getElementsByTagName('p'); //die('<pre>'.print_r($ps,1).'</pre>'); if ($ps->length === 1){ $p = $ps->item(0); return $p->nodeValue; } else { return ''; } }