PHP在字符串中查找http://或www [duplicate]

问题描述

||                                                                                                                   这个问题已经在这里有了答案:                                                      

解决方法

        
function make_clickable($sText) {
    $sClickText = str_replace(\' www.\',\' http://www.\',$sText);
    $sClickText = preg_replace(\"/([\\s])?(http|ftp|https)([\\:\\/\\/])([^\\s]+)/i\",\" <a href=\\\"$2$3$4\\\" target=\\\"_blank\\\">$2$3$4</a>\",$sClickText);
    return $sClickText;
}
多田