<?php
$html = "<meta http-equiv='Content-Type' content='text/html; charset=gbk'>";
$pattern = "/<meta\s+http-equiv=(\'|\")?Content-Type(\'|\")?\s+content=(\'|\")text\/html;\s+charset=(.*)(\'|\")>/i";
$replacement = "<meta http-equiv='Content-Type' content='text/html; charset=big5'>";
$result = preg_replace($pattern, $replacement, $html);
echo htmlspecialchars($result);
?>
$html = "<meta http-equiv='Content-Type' content='text/html; charset=gbk'>";
$pattern = "/<meta\s+http-equiv=(\'|\")?Content-Type(\'|\")?\s+content=(\'|\")text\/html;\s+charset=(.*)(\'|\")>/i";
$replacement = "<meta http-equiv='Content-Type' content='text/html; charset=big5'>";
$result = preg_replace($pattern, $replacement, $html);
echo htmlspecialchars($result);
?>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货