$1', ' $1', '

Home >Backend Development >PHP Tutorial >Hyperlink font color function in php to convert URL to hyperlink

Hyperlink font color function in php to convert URL to hyperlink

WBOY
WBOYOriginal
2016-07-29 08:46:431387browse

Copy code The code is as follows:


function showtext($text){
$search = array('|(http://[^ ]+)|', '|(https://[^ ]+)|', '|(www.[^ ]+)|');
$replace = array('$1', '$1', '$1 ');
$text = preg_replace($search, $replace, $text);
return $text;
}

The above introduces the function of hyperlink font color in PHP to convert a URL into a hyperlink, including the content of hyperlink font color. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn