时间:2021-07-01 10:21:17 帮助过:18人阅读
$content = "abb";//模拟html代码中的 //preg_match('/]+)charset=[a-zA-Z-0-9]+([\'"])>/i',$content,$matches); //var_dump($matches);//此句说明可以匹配到 preg_replace('/]+)charset=[a-zA-Z-0-9]+([\'"])>/i',"",$content); echo $content; //输出abb,也就是说替换不成功,将匹配部分替换为了空
$content = preg_replace('/]+)charset=[a-zA-Z-0-9]+([\'"])>/i',"",$content); echo ''; echo $content;