且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

替换文本字符串中的任何url,以php链接到可点击的链接

更新时间:2022-01-29 22:37:20

您可以使用regexp来做到这一点:

You can use regexp to do this:

$html_links = preg_replace('"\b(https?://\S+)"', '<a href="$1">$1</a>', $text);