取出所有url 并且不要重复

function getJustAllUrl($inUrlText)
{
$parttern = "/http[s]?:\/\/(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+/";
preg_match_all($parttern, $inUrlText, $match);

return count($match) > 0 ? array_unique($match[0]) : '';
}

取出仅仅url

function getJustUrl($inUrlText)
{
$parttern = "/http[s]?:\/\/(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+/";
preg_match($parttern, $inUrlText, $match);
return count($match) > 0 ? $match[0] : '';
}