<?php
//링크치환
function getAutoLink($str) 
{ 
	return preg_replace_callback('/\b(?:https?|ftp):\/\/[^\s<>"\']+/i', function ($matches) {
		$url = $matches[0];
		$safe = htmlspecialchars($url, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
		return '<a href="'.$safe.'" target="_blank" rel="noopener noreferrer" style="text-decoration:underline;">'.$safe.'</a>';
	}, $str);
} 
?>
