Browse Source

合计金额换行问题

master
Lemon 5 years ago
parent
commit
6abb9f9081
  1. 6
      app/Service/FeiePrintService.php

6
app/Service/FeiePrintService.php

@ -141,7 +141,7 @@ class FeiePrintService implements FeiePrintServiceInterface
$m = $m+$j; $m = $m+$j;
$tail = $new; $tail = $new;
// $lenght = iconv("UTF-8", "GBK//IGNORE", $new); // $lenght = iconv("UTF-8", "GBK//IGNORE", $new);
$k = $A - mb_strlen($new,'utf-8');
$k = $A - mb_strwidth($new,'utf-8');
for($q=0;$q<$k;$q++){ for($q=0;$q<$k;$q++){
$kw3 .= ' '; $kw3 .= ' ';
} }
@ -166,7 +166,7 @@ class FeiePrintService implements FeiePrintServiceInterface
foreach ($result as $key=>$value) { foreach ($result as $key=>$value) {
if($key < 1){ if($key < 1){
// $v_lenght = iconv("UTF-8", "GBK//IGNORE", $value); // $v_lenght = iconv("UTF-8", "GBK//IGNORE", $value);
$v_lenght = mb_strlen($value,'utf-8');
$v_lenght = mb_strwidth($value,'utf-8');
if($v_lenght == 13) $value = $value." "; if($v_lenght == 13) $value = $value." ";
$head .= $value.' '.$price.' '.$num.' '.$prices; $head .= $value.' '.$price.' '.$num.' '.$prices;
}else{ }else{
@ -213,7 +213,7 @@ class FeiePrintService implements FeiePrintServiceInterface
$str = $user_name . $total; $str = $user_name . $total;
$kw5 = ''; $kw5 = '';
// $lenght = iconv("UTF-8", "GBK//IGNORE", $str); // $lenght = iconv("UTF-8", "GBK//IGNORE", $str);
$total_len = 32 - mb_strlen($str,'utf-8');
$total_len = 32 - mb_strwidth($str,'utf-8');
for ($q = 0; $q < $total_len; $q++) { for ($q = 0; $q < $total_len; $q++) {
$kw5 .= ' '; $kw5 .= ' ';
} }

Loading…
Cancel
Save