有点呆,看不出两个输出的差别。咳咳...
$#@http://yubeinet.com/bbs
$#@<a href='http://yubeinet.com/bbs'>http://yubeinet.com/bbs</a>
$#@http://yubeinet.com/bbs
$#@<a href='http://yubeinet.com/bbs'>http://yubeinet.com/bbs</a>
$#@http://yubeinet.com/bbs
第二段能输出
$#@http://yubeinet.com/bbs
$#@<a href='http://yubeinet.com/bbs'>http://yubeinet.com/bbs</a>
我实在想不通为什么会这样~~~
要写作:
$c=str_replace($c_match[0][$i],"<a href='".$c_match[1][$i]."'>".$c_match[1][$i]."</a>","$c");
或
$c=str_replace("{$c_match[0][$i]}","<a href='{$c_match[1][$i]}'>{$c_match[1][$i]}</a>","$c");其实有一个高效的写法
$c = "http://yubeinet.com/bbs";
$c .= "http://yubeinet.com/bbs1";
$c .= "http://yubeinet.com/bbs2";
echo preg_replace("|\[url\](.*)\[\/url\]|U","<a href='\\1'>\\1</a>",$c);