分类广告


推荐文章

  • 没有找到任何内容!
您当前的位置:中国站长下载网络编程PHP专区 → 文章内容

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

  • 作者:佚名    来源:不详    发布时间:2006-2-26 1:40:08
  • 字体大小:
$string = &quot;连接http://www.phpx.com 站点&quot;;<br>
//连接后需要有个空格或回车。<br>
<br>
$string =&nbsp;&nbsp;eregi_replace(&quot;http://([^ ,\r\n]*)&quot;,&quot;&lt;a href=\\0 target=_blank&gt;\\0&lt;/a&gt;&quot;,$string);<br>
$string =&nbsp;&nbsp;eregi_replace(&quot;ftp://([^ ,\r\n]*)&quot;,&quot;&lt;a href=\\0 target=_blank&gt;\\0&lt;/a&gt;&quot;,$string);<br>
<br>
print $string; <
相关信息