首页 > 解决方案 > **文本**中的粗体文本标记php

问题描述

我正在使用此函数为用户名着色,以防它存在@username于字符串中。

PHP

$string="this **text** contains a second **content**"

我想加粗文本中包含的文本

我试过但没有

 function bold_word($string) {
   return preg_replace('/(\**+)/', "<b>$1</b>", $string);
    }

标签: php

解决方案


推荐阅读