龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > web编程 > php编程 >

php匹配url的正则表达式

时间:2014-06-19 15:22来源:网络整理 作者:网络 点击:
分享到:
php匹配url的正则表达式 ```{php}//https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)? //PHP Example: Automatically link URL#39;s inside text. $text = preg_replace(#39;@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?
//https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?

//PHP Example: Automatically link URL's inside text.

$text = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', '<a href="$1">$1</a>', $text);
精彩图集

赞助商链接