聯(lián)系官方銷售客服
1835022288
028-61286886
html過濾描述內(nèi)容保留換行和原來的樣式怎么辦?
function dr_clearhtml($str) { $str = str_replace( array(' ', '&', '"', ''', '“', '”', '—', '<', '>', '·', '…'), array(' ', '&', '"', "'", '“', '”', '—', '<', '>', '·', '…'), $str ); $str = preg_replace("/\<[a-z]+(.*)\>/iU", "", $str); $str = preg_replace("/\<\/[a-z]+\>/iU", "", $str); $str = str_replace(array(PHP_EOL, chr(13), chr(10), ' '), '', $str); $str = strip_tags($str); return trim($str); } }
這個代碼怎么改保留換行和原來的樣式
$str = str_replace(array(PH
這段表示刪除換行
但是,這個函數(shù)文件是不能修改的,建議定一個新函數(shù)
回復迅??蚣軇?chuàng)始人
幫我解決這個問題
我的沒書內(nèi)容也用了ueditor 編輯器
描述內(nèi)容字段自動獲取 內(nèi)容的500字
$data[1]['description'] = trim(dr_strcut(dr_custom_html($data[0]['content']), 500));
最起碼什么都不過濾內(nèi)容的500字獲取也真好
custom.php定一個dr_custom_html 新函數(shù)
但是還是去掉換行和 <p dir="rtl" style="text-align: right;"> 這個樣式
對我來說重要的保留<p dir="rtl" style="text-align: right;"> 這個樣式
我會