php 去除html標籤 和 css樣式

2021-08-31 02:53:12 字數 990 閱讀 1775

$content = preg_replace("/]*>/i", "", $content);

$content = preg_replace("/<\/a>/i", "", $content);

$content = preg_replace("/]*>/i", "", $content);

$content = preg_replace("/<\/div>/i", "", $content);

$content = preg_replace("//i", "", $content);//注釋內容

$content = preg_replace("/style=.+?['|\"]/i",'',$content);//去除樣式

$content = preg_replace("/class=.+?['|\"]/i",'',$content);//去除樣式

$content = preg_replace("/id=.+?['|\"]/i",'',$content);//去除樣式

$content = preg_replace("/lang=.+?['|\"]/i",'',$content);//去除樣式

$content = preg_replace("/width=.+?['|\"]/i",'',$content);//去除樣式

$content = preg_replace("/height=.+?['|\"]/i",'',$content);//去除樣式

$content = preg_replace("/border=.+?['|\"]/i",'',$content);//去除樣式

$content = preg_replace("/face=.+?['|\"]/i",'',$content);//去除樣式

$content = preg_replace("/face=.+?['|\"]/",'',$content);//去除樣式 只允許小寫 正則匹配沒有帶 i 引數

PHP如何去除HTML標籤

方法1 直接取出想要取出的標記 取出br標記 function strip str 方法2.php 中有個 strip tags 函式可以方便地去除 html 標籤。echo strip tags helloworld 去除 html xml 以及 php 的標籤。對於非標準的 html 也能正確的...

css標籤和html標籤

一,html 標題標籤 h1,h2,h3,h4,h5,h6 段落標籤 水平線標籤 換行標籤 水平線標籤 size 水平粗細線 width 水平線寬度 align 水平線對齊方式 color 水平線顏色 字型標籤 funt size 文字大小 color 字型顏色 face 文字的字型 標籤 src ...

sql去除html標籤

分類 sql舉報 sql資料庫sql函式 1 建立函式 sql view plain copy create function dbo clearhtml maco varchar 8000 returns varchar 8000 as begin declare i int while 1 1 ...