-1
4

1 回答 1

0
$a = 'this is a link http://somerandomsite.com, check it out!';

$a = preg_replace("/\b((?:http\:\/\/)|(?:www\.))([^ ,]+)/", "<a href=\"$1$2\">$1$2</a>", $a);

echo $a;
于 2013-10-19T14:55:20.377 回答