欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

自定義函數(shù)解決帝國cms的簡介截取字符時出現(xiàn)html的問題

  發(fā)布時間:2020-01-15 16:14:30   作者:佚名   我要評論
正如標題所言帝國cms的簡介截取字符時出現(xiàn)html,針對這個問題,下面有個不錯的解決方法,主要是通過自定義函數(shù)來實現(xiàn)的,感興趣的朋友也可以嘗試操作下

我的解決方法如下,寫了個函數(shù)加進去,大家看看是否可行,有咩有問題,我感覺還行

首先在 e/class/connect.php 文件中加入一個自定義函數(shù) 比如 NoHTML() 這個自己喜歡隨便設(shè)置

//去除HTML標記 
function NoHTML($string){ 
$string = preg_replace("'<script[^>]*?>.*?</script>'si", "", $string);//去掉javascript 
$string = preg_replace("'<[\/\!]*?[^<>]*?>'si", "", $string); //去掉HTML標記 
$string = preg_replace("'([\r\n])[\s]+'", "", $string); //去掉空白字符 
$string = preg_replace("'&(quot|#34);'i", "", $string); //替換HTML實體 
$string = preg_replace("'&(amp|#38);'i", "", $string); 
$string = preg_replace("'&(lt|#60);'i", "", $string); 
$string = preg_replace("'&(gt|#62);'i", "", $string); 
$string = preg_replace("'&(nbsp|#160);'i", "", $string); 
return $string; 
}

然后去列表內(nèi)容模板修改代碼即可

$r[smalltext]=esub(NoHTML($r[smalltext]),200,'......');
$listtemp='<li><strong><a href="[!--titleurl--]">[!--title--]</a></strong><p>[!--smalltext--]</p></li>';
 

這樣問題就解決了,很簡單吧.
由于是中英文的網(wǎng)站,網(wǎng)站名稱需要用到標題,所以這樣修改就很方便了
看看還有沒有問題呢?

相關(guān)文章

最新評論