2012-11-01 206 views
-3

可能重複:
Strip all HTML tags, except allowed刪除HTML標籤

我是新來的PHP

這裏是我的代碼

<p>The filetype you are attempting to upload is not allowed.</p> 

預期的輸出:

The filetype you are attempting to upload is not allowed. 

如何刪除標籤<p>

+1

'谷歌是你對這樣的基本查詢friend' – asprin

+0

的確,我建議你快速瀏覽一下從這個字符串函數列表http://php.net /manual/en/ref.strings.php –

回答

1

使用strip_tags()從您的字符串剝離HTML標籤

$strip = '<p>The filetype you are attempting to upload is not allowed.</p>'; 
echo strip_tags($strip); 

Reference

1
$string= '<p>The filetype you are attempting to upload is not allowed.</p>'; 
$new_string = strip_tags($string); 
0
$str= '<p>The filetype you are attempting to upload is not allowed.</p>'; 
$new_string = strip_tags($str);