如题所述
$str = 'http://www.example.com';//要去除http://的地址
$result = str_replace('http://','',$str);
var_dump($result);//结果 www.example.com
$result = str_replace('http://','',$str);
var_dump($result);//结果 www.example.com
温馨提示:答案为网友推荐,仅供参考
第1个回答 2018-12-19
用正则 preg_match("/(?:http:\/\/)([^\/]+)/",你的字符串,$matched);
结果在$matched里
结果在$matched里
第2个回答 2018-12-19
想要批量替换?可以使用正则或者写程序事先替换好