php过滤掉无法识别的问号字符 你这个txt文本,应该是编码问题,最好是恢复到正确的编码,或者可以完整显示内容。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 估计是中文乱码$aaa = 'dfasd打单机1233';$bbb = preg_replace("/[^\w]/", '', $aaa);echo $bbb; 这个是txt 另存把jpg改为txt就行了跟中文关系不大,因为是个国外的项目,好像是从的数据库里导出来的,还得通过php导入到其他项目里。 说错了 把jpg改为zip解压就行了 试试用这个方法过滤下。function filter_utf8_char($ostr){ preg_match_all('/[\x{FF00}-\x{FFEF}|\x{0000}-\x{00ff}|\x{4e00}-\x{9fff}]+/u', $ostr, $matches); $str = join('', $matches[0]); if($str==''){ //含有特殊字符需要逐個處理 $returnstr = ''; $i = 0; $str_length = strlen($ostr); while ($i<=$str_length){ $temp_str = substr($ostr, $i, 1); $ascnum = Ord($temp_str); if ($ascnum>=224){ $returnstr = $returnstr.substr($ostr, $i, 3); $i = $i + 3; }elseif ($ascnum>=192){ $returnstr = $returnstr.substr($ostr, $i, 2); $i = $i + 2; }elseif ($ascnum>=65 && $ascnum<=90){ $returnstr = $returnstr.substr($ostr, $i, 1); $i = $i + 1; }elseif ($ascnum>=128 && $ascnum<=191){ // 特殊字符 $i = $i + 1; }else{ $returnstr = $returnstr.substr($ostr, $i, 1); $i = $i + 1; } } $str = $returnstr; preg_match_all('/[\x{FF00}-\x{FFEF}|\x{0000}-\x{00ff}|\x{4e00}-\x{9fff}]+/u', $str, $matches); $str = join('', $matches[0]); } return $str;} C#的RC4密串用PHP的RC4解密函数为什么解不出来? 2-101==>1,102-201==>2,202-301==>3... smarty的配置信息??? php怎么样一个文件上传到多个文件夹中 php怎么样用通配符删除一类文件 为什么PHP的负载要比ASP好 超链问题急求 Zend中国技术中心开始支持CSDN的PHP板块 php的时间问题,寻求帮助 如何在文件中存储树结构? mysql表多列排序,得到某个指定值的上一条或下一条,怎么做简单点 在往mysql中插入记录时怎样获得这条记录的id值
$aaa = 'dfasd打单机1233';
$bbb = preg_replace("/[^\w]/", '', $aaa);
echo $bbb;
这个是txt 另存把jpg改为txt就行了跟中文关系不大,因为是个国外的项目,好像是从的数据库里导出来的,还得通过php导入到其他项目里。
function filter_utf8_char($ostr){
preg_match_all('/[\x{FF00}-\x{FFEF}|\x{0000}-\x{00ff}|\x{4e00}-\x{9fff}]+/u', $ostr, $matches);
$str = join('', $matches[0]);
if($str==''){ //含有特殊字符需要逐個處理
$returnstr = '';
$i = 0;
$str_length = strlen($ostr);
while ($i<=$str_length){
$temp_str = substr($ostr, $i, 1);
$ascnum = Ord($temp_str);
if ($ascnum>=224){
$returnstr = $returnstr.substr($ostr, $i, 3);
$i = $i + 3;
}elseif ($ascnum>=192){
$returnstr = $returnstr.substr($ostr, $i, 2);
$i = $i + 2;
}elseif ($ascnum>=65 && $ascnum<=90){
$returnstr = $returnstr.substr($ostr, $i, 1);
$i = $i + 1;
}elseif ($ascnum>=128 && $ascnum<=191){ // 特殊字符
$i = $i + 1;
}else{
$returnstr = $returnstr.substr($ostr, $i, 1);
$i = $i + 1;
}
}
$str = $returnstr;
preg_match_all('/[\x{FF00}-\x{FFEF}|\x{0000}-\x{00ff}|\x{4e00}-\x{9fff}]+/u', $str, $matches);
$str = join('', $matches[0]);
}
return $str;
}