[英]PHP Simple HTML DOM parser: excluding tags
I need to exclude a 我需要排除一个
imgtag from 标签来自
$first_anchor = $list->find('a',0);
$prof_img = $first_anchor->find('img',0)->src;
echo $prof_name = $first_anchor->innertext;die();
and get only the text ie Matt Carledge. 并获得只有马特Carledge的文字。 Is it possitble using php simple html dom parser? 是否可以使用php简单的html dom解析器? Thnk you. 谢谢。
$first_anchor = $list->find('a',0); $prof_img = $first_anchor->find('img',0)->src; echo $prof_name = $first_anchor->innertext;die();
i need prof_name to be "Matt Cartledge". 我需要prof_name成为“Matt Cartledge”。
Ah got it, its ->plaintext; 啊得到它,它 - >明文; thnk you 谢谢
If we use like $something->innertext;(It gives everthing inside $something including all tags within it) AND if we use $something->plaintext;(It give only the texts exluding the tags). 如果我们使用像$ something-> innertext;(它在$ something内部包括其中的所有标签)和如果我们使用$ something-> plaintext;(它只给出排除标签的文本)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.