1' , $text); $text = eregi_replace('([[:space:]()[{}"> exmail.qq.com Use PHP to convert URL string into hyperlink URL or email-PHP Tutorial-php.cn

exmail.qq.com Use PHP to convert URL string into hyperlink URL or email

WBOY
Release: 2016-07-29 08:42:49
Original
1954 people have browsed it

Copy codeThe code is as follows:


function makeClickableLinks($text) {
$text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0- 9@:%_+.~#?&//=]+)', '1', $text);
$text = eregi_replace('([ [:space:]()[{}])(www.[-a-zA-Z0-9@:%_+.~#?&//=]+)','12', $text);
$text = eregi_replace('([_.0-9a-z-]+@([0-9a-z][0-9a -z-]+.)+[a-z]{2,3})', '1', $text);
return $text;
}


Implementation principle:
Mainly using the regular principle to match URL characters or emails to replace them with hyperlinks.

The above has introduced the use of PHP to convert exmail.qq.com URL string into a hyperlink URL or email, including the content of exmail.qq.com. 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!