<u>复制代码</u> 代码如下: <br>function showtext($text){ <br>$search = array('|(http://[^ ]+)|', '|(https://[^ ]+)|', '|(www.[^ ]+)|'); <br>$replace = array('<a href="%241" target="_blank">$1</a>', '<a href="%241" target="_blank">$1</a>', '<a href="http://%241" target="_blank">$1</a>'); <br>$text = preg_replace($search, $replace, $text); <br>return $text; <br>} <br>