We may need to extract content from a HTML file. For example I got a HTML file from Tinymce editor as below:
<div class="mceContentBody">
<p>This is a test</p>
<p>This is a test</p>
</div>
I only need the content:This is a test
We can use PHP function: strip_tags, which strips HTML and PHP tags from a string.
Below is the PHP code to extract content: This is a test
<?php
$mystring='
<div class="mceContentBody">
<p>This is a test</p>
<p>This is a test</p>
</div>';
echo strip_tags($mystring);
?>
echo strip_tags($mystring);
No comments:
Post a Comment