高手帮我看下这段程序怎么没有实现替代的效果
<?php
$text="this is a link to http://www.wjgilmore.com/.";
echo ereg_replace("http://([a-zA-Z0-9./-]+)$","<a href=\"\\0\">\\0</a>",$text);
?>
我的目的是显示带有<a http://www.wjgilmore.com>http://www.wjgilmore.com</a>
...全文
1029打赏收藏
高手帮忙看下
高手帮我看下这段程序怎么没有实现替代的效果 <?php $text="this is a link to http://www.wjgilmore.com/."; echo ereg_replace("http://([a-zA-Z0-9./-]+)$","\\0",$text); ?> 我的目的是显示带有http://www.wjgilmore.com
$text="this is a link to http://www.wjgilmore.com/.";
echo ereg_replace("http://([a-zA-Z0-9./-]+)$","<a href=\"\\0\">\\0</a>",$text);
得到
this is a link to <a href="http://www.wjgilmore.com/.">http://www.wjgilmore.com/.</a>
对比一下差异,当然这无碍大局