<?php
$url = 'str_memo=http://www.test.com/index.php?link=[URL]&title=[TITLE]';
$url = preg_replace('/(\[url\])/i', 'www.aaa.com', $url);
$url = preg_replace('/(\[title\])/i', 'helala', $url);
print $url;
?>

解决方案 »

  1.   

    $content = eregi_replace("\\[url\\]www.([^\\[]*)\\[/url\\]", "<a href=\"http://www.\\1\" target=_blank>www.\\1</a>",$content);
    $content = eregi_replace("\\[url\\]([^\\[]*)\\[/url\\]","<a href=\"\\1\" target=_blank>\\1</a>",$content);
    $content = eregi_replace("\\[url=([^\\[]*)\\]([^\\[]*)\\[/url\\]","<a href=\"\\1\" target=_blank>\\2</a>",$content);
      

  2.   

    <?php
    $url = 'str_memo=http://www.test.com/index.php?link=[URL]&title=[TITLE]';
    $url = preg_replace('/(\[url\])/i', '地址', $url);
    $url = preg_replace('/(\[title\])/i', '标题', $url);
    echo  $url;
    ?>