将下面函数拷贝到e/class/userfun.php里面
使用方法: |-----------函数说明:esub_two(需要去掉字符的字段,截取的字符数不填为不截取) | |-----------灵动标签使用范例: | <p>内容简介:<?=esub_two($bqr[smalltext],240)?></p> | |-----------列表页(标签模板)list.var使用范例: | <P>内容简介:'.esub_two($r[smalltext],240).'</p> | |-----------内容页使用范例 | <p>文章导读:<?=esub_two($navinfor[smalltext],240)?></p>
=========================================================
//以下是复制到e/class/userfun.php里面的函数 //替换无用字符并截取字符 function esub_two($string,$num) { if(empty($num)) { $str = Str_Replace2($string); } else { $str = esub(Str_Replace2($string),$num); } return $str; }
function Str_Replace2($str) { $string = str_replace("“","“",$str); $string = str_replace("”","”",$string); $string = str_replace("&","&",$string); $string = str_replace("·","•",$string); $string = str_replace("—","—",$string); $string = str_replace("…","…",$string); $string = str_replace(" ","",$string); $string = str_replace("<","<",$string); $string = str_replace(">",">",$string); $string = str_replace("–","-",$string); $string = str_replace(" ","",$string); return $string; }
|