日期:2012-05-15  浏览次数:20604 次

1. Type:选择条形码类型

2. Output:输出的图片格式

3. Thickness:条形码高度

4. Resolution:条形码大小

5. Font:条形码下方的文字大小,也可不显示文字

6. Text:条形码打印的内容

条码效果

当然,这个PHP5生成条形码程序只是将文字生成为条形码,但使用时不能灵活将其嵌入其他PHP程序,我将压缩包里面的test.php做了一些调整,使其能灵活的用于其他程序。运行时只需将条码类型和文字传给test.php即可,例如:
http://localhost/barcode/test.php?codebar=BCGcode39&text=20090729

或运行http://localhost/barcode/mytest.php

mytest.php代码:

  1. <img src="test.php?codebar=BCGcode39&text=20090729"> 
PHP5生成条形码效果图:

运行实例效果图

PHP5生成条形码test.php代码:

  1. <?php  
  2. // Including all required classes 
  3. require('class/BCGFont.php');  
  4. require('class/BCGColor.php');  
  5. require('class/BCGDrawing.php');  
  6. /*'BCGcodabar','BCGcode11','BCGcode39','BCGcode39extended','BCGcode93', 
  7. 'BCGcode128','BCGean8','BCGean13','BCGisbn','BCGi25','BCGs25','BCGmsi', 
  8. 'BCGupca','BCGupce','BCGupcext2','BCGupcext5','BCGpostnet','BCGothercode'*/ 
  9. $codebar = $_REQUEST['codebar']; //该软件支持的所有编码,只需调整$codebar参数即可。 
  10. // Including the barcode technology 
  11. include('class/'.$codebar.'.barcode.php');