我想知道是thier逃脫從AA一串HTML代碼的所有HTML標籤,而只提取文本即轉義html標籤並只讀取php中的文本?
<strong>this is strong</strong>
<br />
<h1> this is a header</h1>
的方式,我想只有標籤之間的文本,所以基本上只 this is strong this is a header
我想知道是thier逃脫從AA一串HTML代碼的所有HTML標籤,而只提取文本即轉義html標籤並只讀取php中的文本?
<strong>this is strong</strong>
<br />
<h1> this is a header</h1>
的方式,我想只有標籤之間的文本,所以基本上只 this is strong this is a header
$text = '<p>Test paragraph.</p><!-- Comment --> <a href="#fragment">Other text</a>';
echo strip_tags($text);
我喜歡PHP的東西之一......對於web開發人員來說,體貼的功能。
使用strip_tags功能
$text = '<p>Test paragraph.</p><!-- Comment --> <a href="#fragment">Other text</a>';
echo strip_tags($text);
將輸出
試驗段。其他文字
剝離整個HTML塊,http://www.phpro.org/examples/Get-Text-Between-Tags.html有一些很好的功能和例子。
使用strip_tags()這樣的:
$html = "<strong>this is strong</strong><br />\n".
"<h1> this is a header</h1>";
$text = strip_tags($html);
什麼fragements笑,感謝那是複製一個非常明確的答案:))+給予好評,從我 – getaway 2010-11-08 15:03:24
/從PHP手冊直粘貼。 ;) – clifgriffin 2010-11-08 15:04:36