谷徳美食网
您的当前位置:首页php如何去掉中文

php如何去掉中文

来源:谷徳美食网


PHP去除字符串中的中文字符

删除一段字符串的中的中文,只要正则替换中文字符为空字符即可:

<?php
header('Content-type:text/html;charset=utf-8');
 
 
function p($arr){
echo "<pre>";
print_r($arr);
echo "</pre>";
}
 
 
$a = "<a>河蟹)(社会afeowa#$%^!@@#zf吃饭fawgwea汉堡包agho_iawghowi我日)</a>";
$result = preg_replace('/([x80-xff]*)/i','',$a);
p($result);
 
 
?>

更多相关知识,请访问PHP中文网!

显示全文