|
本帖最后由 hbghlyj 于 2022-1-16 02:13 编辑 function_discuzcode.php代码片段:- $message = str_replace(array(
- '[/color]', '[/backcolor]', '[/size]', '[/font]', '[/align]', '[b]', '[/b]', '[s]', '[/s]', '[hr]', '[/p]',
- '[i=s]', '[i]', '[/i]', '[u]', '[/u]', '[list]', '[list=1]', '[list=a]',
- '[list=A]', "\r\n[*]", '[*]', '[/list]', '[indent]', '[/indent]', '[/float]'
- ), array(
- '</font>', '</font>', '</font>', '</font>', '</div>', '<strong>', '</strong>', '<strike>', '</strike>', '<hr class="l" />', '</p>', '<i class="pstatus">', '<i>',
- '</i>', '<u>', '</u>', '<ul>', '<ul type="1" class="litype_1">', '<ul type="a" class="litype_2">',
- '<ul type="A" class="litype_3">', '<li>', '<li>', '</ul>', '<blockquote>', '</blockquote>', '</span>'
- ), preg_replace(array(
- "/\[color=([#\w]+?)\]/i",
- "/\[color=((rgb|rgba)\([\d\s,]+?\))\]/i",
- "/\[backcolor=([#\w]+?)\]/i",
- "/\[backcolor=((rgb|rgba)\([\d\s,]+?\))\]/i",
- "/\[size=(\d{1,2}?)\]/i",
- "/\[size=(\d{1,2}(\.\d{1,2}+)?(px|pt)+?)\]/i",
- "/\[font=([^\[\<]+?)\]/i",
- "/\[align=(left|center|right)\]/i",
- "/\[p=(\d{1,2}|null), (\d{1,2}|null), (left|center|right)\]/i",
- "/\[float=left\]/i",
- "/\[float=right\]/i"
- ), array(
- "<font color=\"\\1\">",
- "<font style=\"color:\\1\">",
- "<font style=\"background-color:\\1\">",
- "<font style=\"background-color:\\1\">",
- "<font size=\"\\1\">",
- "<font style=\"font-size:\\1\">",
- "<font face=\"\\1\">",
- "<div align=\"\\1\">",
- "<p style=\"line-height:\\1px;text-indent:\\2em;text-align:\\3\">",
- "<span style=\"float:left;margin-right:5px\">",
- "<span style=\"float:right;margin-left:5px\">"
- ), $message));
复制代码 list=1的效果
list=a的效果
list=A的效果
|
|