Browse Source

修改导出excel表格数据,大数字会转为二进制的问题

齐博 1 year ago
parent
commit
a65addaae7
1 changed files with 5 additions and 0 deletions
  1. 5 0
      application/common/controller/admin/C.php

+ 5 - 0
application/common/controller/admin/C.php

@@ -605,6 +605,11 @@ abstract class C extends AdminBase
             $rs = $this->model->getInfoByid($id , true);
             $outstr.="<tr><td align=\"center\">$rs[id]</td>";
             foreach($fieldDB AS $k=>$v){
+                
+                if( preg_match('/^[\d]{10,}$/', $rs[$k]) || preg_match('/^0[\d]+$/', $rs[$k]) ){    //处理数字被转化为二进制的问题
+                    $rs[$k] = '&nbsp;'.$rs[$k].'&nbsp;';
+                }
+                
                 $outstr.="<td align=\"center\">{$rs[$k]}</td>";
             }
             $outstr.="</tr>";