普通网友 2019-08-13 04:25
浏览 76

php条形码在CodeIgniter中生成错误

i was looking for code to generate barcode in invoice and i'm using CodeIgniter so i find a file generate the barcode i need , the project is parking system . after added the barcode file using include func -> the adding new parking module doesn't show the rate which it must appear automatically based on category
this is the barcode code :

<?php ?>

<style>
  div.b128 {
    height: 40px;
    border-left: 1px black solid;
  }
</style>

<?php
global $char128asc,$char128charWidth;
$char128asc=' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'; 
$char128wid = array(
 '212222','222122','222221','121223','121322','131222','122213','122312','132212','221213', // 0-9 
 '221312','231212','112232','122132','122231','113222','123122','123221','223211','221132', // 10-19 
 '221231','213212','223112','312131','311222','321122','321221','312212','322112','322211', // 20-29 
 '212123','212321','232121','111323','131123','131321','112313','132113','132311','211313', // 30-39 
 '231113','231311','112133','112331','132131','113123','113321','133121','313121','211331', // 40-49 
 '231131','213113','213311','213131','311123','311321','331121','312113','312311','332111', // 50-59 
 '314111','221411','431111','111224','111422','121124','121421','141122','141221','112214', // 60-69 
 '112412','122114','122411','142112','142211','241211','221114','413111','241112','134111', // 70-79 
 '111242','121142','121241','114212','124112','124211','411212','421112','421211','212141', // 80-89 
 '214121','412121','111143','111341','131141','114113','114311','411113','411311','113141', // 90-99
 '114131','311141','411131','211412','211214','211232','23311120' ); // 100-106
 
////Define Function
function bar128($text) { // Part 1, make list of widths
 global $char128asc,$char128wid; 
 $w = $char128wid[$sum = 104]; // START symbol
 $onChar=1;
 for($x=0;$x<strlen($text);$x++) // GO THRU TEXT GET LETTERS
 if (!( ($pos = strpos($char128asc,$text[$x])) === false )){ // SKIP NOT FOUND CHARS
 $w.= $char128wid[$pos];
 $sum += $onChar++ * $pos;
 } 
 $w.= $char128wid[ $sum % 103 ].$char128wid[106]; //Check Code, then END
 //Part 2, Write rows
 $html="<table cellpadding=0 cellspacing=0><tr>"; 
 for($x=0;$x<strlen($w);$x+=2) // code 128 widths: black border, then white space
 $html .= "<td><div class=\"b128\" style=\"border-left-width:{$w[$x]};width:{$w[$x+1]}\"></div>"; 
 return "$html<tr><td colspan=".strlen($w)." align=center><font family=arial size=1><b>$text</table>"; 
}
?>

i have try too much method but it dosen't work

this is the function in controlle page that doesn't work with barcode code

public function getCategoryRate($id) 
{
    if($id) {
        $rate_data = $this->model_rates->getCategoryRate($id);
        $html = '';
        foreach ($rate_data as $k => $v) {
            $html .= '<option value="'.$v['id'].'">'.$v['rate_name'].'</option>';
        }

        echo json_encode($html);
    }
}

}
</div>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 安卓adb backup备份应用数据失败
    • ¥15 eclipse运行项目时遇到的问题
    • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
    • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
    • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
    • ¥50 成都蓉城足球俱乐部小程序抢票
    • ¥15 yolov7训练自己的数据集
    • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
    • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
    • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)