【发布时间】:2016-12-04 10:47:06
【问题描述】:
我有一个从位置 6 到 11 的文本字符串,我想用 HTML 链接替换它
我该怎么做?
$text = 'hello world this is my question , plz help';
$position_from = 15;
$position_to = 20;
$link = 'http://google.com';
我需要一个函数来给我这个:
$text = 'hello <a href="http://google.com">world</a> this is my question , plz help';
【问题讨论】:
-
您想用链接替换
word?或<link>word</link>
标签: php string replace substring