使链接在文本块中可单击的最佳方式
2022-08-30 18:51:04
我想要:
Here is link: http://google.com And http://example.com inside. And another one at the very end: http://test.net
成为:
Here is link: <a href="http://google.com">http://google.com</a> And <a href="http://example.com">http://example.com</a> inside. And another one at the very end: <a href="http://test.net">http://test.net</a>
这似乎是一个微不足道的任务,但我找不到一个有效的PHP函数。你有什么想法吗?
function make_links_clickable($text){
// ???
}
$text = 'Here is link: http://google.com
And http://example.com inside.
And another one at the very end: http://test.net';
echo make_links_clickable($text);