Home > php教程 > php手册 > body text

列个正则表达式,判断一段留言中的http;//www.phpx.com,在显示的时候加上超连接。

WBOY
Release: 2016-06-21 09:12:49
Original
826 people have browsed it

显示|正则

$string = "连接http://www.phpx.com 站点";

//连接后需要有个空格或回车。



$string =  eregi_replace("http://([^ ,\r\n]*)","\\0",$string);

$string =  eregi_replace("ftp://([^ ,\r\n]*)","\\0",$string);



print $string;



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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template