$1', ' Hyperlink font color function in php to convert URL to hyperlink-PHP Tutorial-php.cn

Hyperlink font color function in php to convert URL to hyperlink

WBOY
Release: 2016-07-29 08:46:43
Original
1315 people have browsed it

Copy codeThe 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.

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!