0

私はsimplehtmldom.sourceforge.netを使用しています

クリア要素が欲しい$e <font size="2"><b>Listen to INT_routine on the January 15th, 2007 Urban-D Radio Podcast!</b></font>

私は機能を使用します:$e->clear()要素は削除しますが、残します</font>

要素を完全にきれいにする方法は?

4

1 に答える 1

0

私はこのライブラリを使用したことはありませんが、調べています。これがトリックを行うかどうかを確認してください..

echo str_get_html('<font size="2"><b>Listen to INT_routine on the January 15th, 2007 Urban-D Radio Podcast!</b></font>')->plaintext;

またはこれ。.

$tagtext = (string)"<font size="2"><b>Listen to INT_routine on the January 15th, 2007 Urban-D Radio Podcast!</b></font>";
var_dump(str_get_html($tagtext)->plaintext);

編集:

// Example 

$html = str_get_html("<div>foo <b>bar</b></div>");  
$e = $html->find("div", 0); 

echo $e->tag; // Returns: " div" 

echo $e->outertext; // Returns: " <div>foo <b>bar</b></div>" 

echo $e->innertext; // Returns: " foo <b>bar</b>"

echo $e->plaintext; // Returns: " foo bar"
于 2011-08-17T01:48:09.607 に答える