//取得字符串中漢字字符數字下劃線和短連接符、逗號、句號、分號、冒號、書名號、問號等非特殊字符
public function getescapeChinese($str,$charset='utf8'){
if($charset=='gb2312'){
if(!preg_match_all('/^['.chr(0xa1).'-'.chr(0xff).'A-Za-z0-9_\-\,\。\,\.\;\;\:\:\《\》\?\?\%\%\!\!\~\~]+/',$str,$match)){
return false;
}
return implode('',$match[0]);
}
if($charset=='utf8'){
if(!preg_match_all('/[\x{4e00}-\x{9fa5}A-Za-z0-9_\-\,\。\,\.\;\;\:\:\《\》\?\?\%\%\!\!\~\~]+/u',$str,$match)){
return false;
}
return implode('',$match[0]);
}
return false;
}