看看这个并帮助我将其修复为工作..这不起作用..
$text = "Hello I am the PHP.go from here http://php.net"
$pattern = "/http:\/\/(www\.)?([^.]+\.[^.\s]+\.?[^.\s]*)/i";
$replace = "<a href='http://\\1\\2'>http://\\1\\2</a>";
$string = preg_replace($pattern,$replace,$text);
echo $string;
这是它显示的错误。
Parse error: syntax error, unexpected '$pattern' (T_VARIABLE) in