Get text with PHP Simple HTML DOM Parser

谁说我不能喝 提交于 2019-12-04 21:56:54

It looks like $text->find('text',2); gets what you're looking for, however I'm not sure how well that will work when the amount of text nodes is unknown. I'll keep looking.

Peachy

You can simply strip html tags using strip_tags

<?php
strip_tags($input, '<br>');
?>

Use strip tags, as @Peachy pointed out. However, passing it a second argument <br> means string will ignore <br> tags, which is unnecessary. In your case,

<?php
    strip_tags($text);
?>

would work as you'd like, given that you are only selecting content in the content id.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!