phpでURLをハイパーリンクの関数に変換します。

496 ワード

 
  
function showtext($text){
$search = array('|(http://[^ ]+)|', '|(https://[^ ]+)|', '|(www.[^ ]+)|');
$replace = array('$1', '$1', '$1');
$text = preg_replace($search, $replace, $text);
return $text;
}