$url = 'https://www.baidu.com/'; if(preg_match('/^http(s)?:\/\/.+/',$url)) { echo '带'; }else { echo '不带'; }