1

除外する必要があります

img
からのタグ

 <a href="http://www.facebook.com/xxxxxx">
     <img style="float: left; margin-right: 10px;" 
          src="http://profile.ak.fbcdn.net/xxxxx/xxxxx.jpg">
      Matt Cartledge
 </a>

テキスト、つまりMattCarledgeのみを取得します。php simple html domパーサーを使用することは可能ですか?ありがとう。

$first_anchor = $list->find('a',0);
$prof_img = $first_anchor->find('img',0)->src;
echo $prof_name = $first_anchor->innertext;die();

prof_nameを「MattCartledge」にする必要があります。

4

1 に答える 1

3

ああ、わかった、その->平文; ありがとう

$ something-> innertext;(その中のすべてのタグを含む$ something内のすべてのものを提供します)および$ something-> plaintext;(タグを除くテキストのみを提供します)のように使用する場合。

于 2013-01-23T06:40:27.663 に答える