<?php
$str = 'abc<div id="head">.............................. </div>abc';
$result = preg_replace('/<div id="head">.+?<\/div>/','',$str);
echo $result;
?>
$str = 'abc<div id="head">.............................. </div>abc';
$result = preg_replace('/<div id="head">.+?<\/div>/','',$str);
echo $result;
?>
最好能提供id=head的封闭</div>后面的字符否则用JS吧
onload或写在最后
document.getElementById('head').parentNode.removeChild(document.getElementById('head'));