php 正则 网址 url http 常用
$source = $_SERVER['HTTP_HOST']; if (preg_match('/(http:\/\/)|(https:\/\/)/i', $source)) { $source = preg_replace('/(http:\/\/)|(https:\/\/)/i', '', $source); // 去掉 h t t p: //和 h t t ps: //前缀 }
$source = $_SERVER['HTTP_HOST']; if (preg_match('/(http:\/\/)|(https:\/\/)/i', $source)) { $source = preg_replace('/(http:\/\/)|(https:\/\/)/i', '', $source); // 去掉 h t t p: //和 h t t ps: //前缀 }