0
我使用php wordwrap爲我的評論框。鏈接點擊和wordwrap
這是我點擊的功能,
function clickable_link($text)
{
$ret = ' ' . $text;
$ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,[email protected]\[\]+]*)#is", "\\1<a class=\"hrefLink\" href=\"\\2\" target=\"_blank\">\\2</a>", $ret);
$ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\#$%&~/.\-;:=,[email protected]\[\]+]*)#is", "\\1<a class=\"hrefLink\" href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret);
$ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\[email protected]\\3\">\\[email protected]\\3</a>", $ret);
$ret = substr($ret, 1);
return $ret;
}
,這是我對此事發表評論的換行
$comment = clickable_link($comment);
$comment = wordwrap($comment, 25, "\n", false);
因此,一旦達到了25字的限制,我的評論框打破我的鏈接
http://www.websitetitle.com/showthread.php?t=2000
鏈接就變成這樣了
http://www.websitetitle.com/showthread.php?
<br>
t=2000
鏈接已損壞。那麼是否有可能修復鏈接或其他解決方法?
謝謝