【发布时间】:2012-12-23 14:58:45
【问题描述】:
我有一个包含文本的字符串,并且在几个地方会有一个 twitter 风格的主题标签。我想找到它们并创建一个单独的变量,其中所有变量都用空格分隔。我还想将原始字符串中的所有主题标签转换为链接。示例:
$string = "Hello. This is a #hashtag and this is yet another #hashtag. This is #another #example."
函数后:
$string_f = "Hello this is a <a href='#'>#hashtag</a> and this is yet another <a href='#'>#hashtag</a>. This is <a href='#'>another</a> <a href='#'>example</a>";
$tags = '#hashtag #another #example';
【问题讨论】:
标签: php