के साथ शीर्षलेख जोड़ता है मैं DOMDocument क्लास के माध्यम से प्रत्येक लिंक में # बी हैश जोड़ रहा हूं।php DOMDocument <html> शीर्षलेख DOCTYPE घोषणा
$dom = new DOMDocument();
$dom->loadHTML($output);
$a_tags = $dom->getElementsByTagName('a');
foreach($a_tags as $a)
{
$value = $a->getAttribute('href');
$a->setAttribute('href', $value . '#b');
}
return $dom->saveHTML();
कि ठीक काम करता है, फिर भी लौट आए उत्पादन एक DOCTYPE
घोषणा और एक <head>
और <body>
टैग शामिल है। कोई विचार क्यों होता है या मैं इसे कैसे रोक सकता हूं?
संभव डुप्लिकेट [पीएचपी + DOMDocument: तत्व के लिए outerHTML] (http://stackoverflow.com/questions/5404941/php-domdocument-outerhtml-for-element) – hakre