Loading... phpcms截取简介时,前面的空格是用什么方法去掉的(注意替换的是全角空格还是半角空格) 截取简介时,前面的空格是用什么方法去掉的,默认的`{str_cut($r[description], 140,'...')}`好像不能清除空格 解决办法: {trim(str_cut($r[description], 140,'…'))} 或:`{deletehtml($r[description])}` 或:`{deletehtml(str_cut($r[description], 140,'…'))}` 或:`{trim($r['description'])}` ========================================================= /** * PHP 过滤HTML代码空格,回车换行符的函数 * echo deletehtml() */ function deletehtml($str){ $str = trim($str); $str=strip_tags($str,""); $str=preg_replace("{\t}","",$str); $str=preg_replace("{\r\n}","",$str); $str=preg_replace("{\r}","",$str); $str=preg_replace("{\n}","",$str); $str=preg_replace("{ }","",$str); return $str; } {deletehtml(str_cut($r[description], 140,'…'))} =============================================================== Last modification:September 21, 2022 © Allow specification reprint Like 如果觉得我的文章对你有用,请随意赞赏