1. type:选择条形码类型
2. output:输出的图片格式
3. thickness:条形码高度
4. resolution:条形码大小
5. font:条形码下方的文字大小,也可不显示文字
6. text:条形码打印的内容
498)this.width=498; onmousewheel=javascript:return big(this) alt=条码效果 src=http://www.bkjia.com/uploadfile/2013/0904/20130904094617982.jpg width=615 style=max-width:90%>
当然,这个php5生成条形码程序只是将文字生成为条形码,但使用时不能灵活将其嵌入其他php程序,我将压缩包里面的test.php做了一些调整,使其能灵活的用于其他程序。运行时只需将条码类型和文字传给test.php即可,例如:
http://localhost/barcode/test.php?codebar=bcgcode39&text=20090729
或运行 http://localhost/barcode/mytest.php
mytest.php代码:
img src=test.php?codebar=bcgcode39&text=20090729>
php5生成条形码效果图:
498)this.width=498; onmousewheel=javascript:return big(this) alt=运行实例效果图 src=http://www.bkjia.com/uploadfile/2013/0904/20130904094617379.jpg width=665 style=max-width:90%>
php5生成条形码test.php代码:
setscale(2); // resolution $code->setthickness(30); // thickness $code->setforegroundcolor($color_black); // color of bars $code->setbackgroundcolor($color_white); // color of spaces $code->setfont($font); // font (or 0) $text = $_request['text']; //php5生成条形码将要数据的内容 $code->parse($text); /* here is the list of the arguments 1 - filename (empty : display on screen) 2 - background color */ $drawing = new bcgdrawing('', $color_white); $drawing->setbarcode($code); $drawing->draw(); // header that says it is an image (remove it if you save the barcode to a file) header('content-type: image/png'); // draw (or save) the image into png format. $drawing->finish(bcgdrawing::img_format_png); ?> 在运行过程中出现异常;
throw $e; //重掷异常
}
}
?﹥
http://www.bkjia.com/phpjc/446609.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/446609.htmltecharticle该软件支持php4和php5两个版本,本文中使用的是php5的版本。在使用前注意要将php的gd模块开启。在windows中为php_gd2.dll,linux中为gd.so。将压缩...
