经测试代码如下:
@H_403_4@ /** * 匹配url的正则 * * @param * @arrange (512.笔记) jb51.cc **/ //https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)? $text = preg_replace('@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@','<a href="$1">$1</a>',$text); /*** 代码来自编程之家 jb51.cc(jb51.cc) ***/原文链接:https://www.f2er.com/php/528840.html