wangyongdong
9/19/2019 - 6:56 AM

判断是否包含http

/**
 * 判断是否包含http
 */
function ishttp($source, $replace = false) {
    if (preg_match('/(http:\/\/)|(https:\/\/)/i', $source)) {
        if($replace) {
            $source = preg_replace('/(http:\/\/)|(https:\/\/)/i', '', $source);
            return $source;
        }
        return true;
    }
    return false;
}