我想獲得與div的價值與內部大教堂通過ID獲取元素,當我嘗試這樣做,我得到的價值是'遊戲和新遊戲發佈'從該div和我沒有得到的PHP值和PHP標籤在所有例如。 <? php回聲hellow世界如下所示。我想獲得變量$ existing_Data中的div的所有內容,包括<? PHP和< H1>等。獲取php標籤內的一個div與PHP大教堂
$selected_div = "div_footer";
$file = '../myfolder/22selected.php';
$file_get = file_get_contents($file);
/* // which one to use here ? i am getting a headache !
$file_entity = htmlentities($file_get);
$file_htmlcharac = htmlspecialchars($file_entity);
$file_strip = stripslashes($file_htmlcharac);
*/
$doc = new DOMdocument();
$doc->loadHTML($file_get);
$element = $doc->getElementById($selected_div);
$existing_Data = $element->firstChild->nodeValue;
echo '<table>';
echo '<form action= "existing_Data.php" method = "POST">';
echo 'Text Content <textarea rows="12" cols="60" name="content" id ="text_content">' . $existing_Data . '</textarea>';
echo '<input type ="submit" name = "submit" id = "submit" value = "Submit" ></form>';
// div_footer CONTENTS
<div id = "div_footer">
<h1> All games</h1>
<p> new games releases</p>
<?php echo "hello world"; ?>
</div>
什麼你想做什麼? – 2015-04-02 04:27:54