php格式化文本换行缩进

曾经针对文本的换行添加样式的简单方法,记一下笔记
public static function add_html_p($text){
    $keyword_arr = explode("\n", $text);
    $new_text = '';
    foreach ($keyword_arr as $k => $v){
        $new_text .= '<p style="text-indent:2em;margin: 0px;line-height:1.7">'.$v.'</p>';
    }
    return $new_text;
}

猜你喜欢

转载自www.cnblogs.com/night-bright/p/11609968.html
今日推荐