preg_quote

$p = 'http://';
$p = '/'.preg_quote($p, '/').'/';
echo $p;/http\:\/\//
本站公众号
   欢迎关注本站公众号,获取更多信息