- function noHTML($content)
- {
- $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("/<\/font>/i",'', $content);
- $content = preg_replace("/]*>/i",'', $content);
- $content = preg_replace("/<\/p>/i",'', $content);
- $content = preg_replace("/]*>/i",'', $content);
- $content = preg_replace("/<\/span>/i",'', $content);
- $content = preg_replace("/<\?xml[^>]*>/i",'', $content);
- $content = preg_replace("/<\/\?xml>/i",'', $content);
- $content = preg_replace("/]*>/i",'', $content);
- $content = preg_replace("/<\/o:p>/i",'', $content);
- $content = preg_replace("/]*>/i",'', $content);
- $content = preg_replace("/<\/u>/i",'', $content);
- $content = preg_replace("/]*>/i",'', $content);
- $content = preg_replace("/<\/b>/i",'', $content);
- $content = preg_replace("/]*>/i",'', $content);
- $content = preg_replace("/<\/meta>/i",'', $content);
- $content = preg_replace("//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);
- $content = preg_replace("/face=.+?['|\"]/",'',$content);
- $content=str_replace( " ","",$content);
- return $content;
- }
複製代碼
>>> 您可能感興趣的文章:PHP刪除html標籤的代碼php 判斷字串是否包含html標籤提取html標籤的php程式碼範例php提取HTML標籤的方法舉例php去除HTML標籤的二種方法php 去除多餘的HTML標籤php正則 尋找html中包含id屬性的html標籤php用strip_tags完整去除所有html標籤的執行個體分享php刪除html標籤的三種方法分享php刪除html標籤及字串中html標籤的代碼php刪除字串中html標籤的函數提取html標籤的php代碼php正則過濾html標籤、空格、分行符號等的程式碼範例修複未正常關閉的HTML標籤(支援嵌套和就近閉合)的代碼php去除html標籤獲得輸入純文字文檔strip_tagsphp使HTML標籤自動補全閉合函數的代碼php實現html標籤自動補全的代碼 |