laravel条形码 二维码 生成
- composer require milon/barcode 5.3
class CodeController extends Controller
{
//
public function yicode(Request $request){
$cc = new DNS1D();
i m g = “ d a t a : i m a g e / p n g ; b a s e 64 , “ . img = “data:image/png;base64,”. img=”data:image/png;base64,”.cc->getBarcodePNG( r e q u e s t − > n u m , request->num, request−>num,request->type);
return $img;
}
}
num为传入的号码 ,type为条形码类型
PS//www.luohun.org/index.php/archives/33/
https://laravel-china.org/index.php/courses/laravel-package/bar-code-generation-tool-milonbarcode/2037
http://www.luohun.org/index.php/archives/33/#comment-27
PLAN B:
use Milon\Barcode\DNS1D;
class BarcodeController extends Controller
{
//生成条形码
public function index(Request $request){
$cc = new DNS1D();
t i t l e = s u b s t r ( title = substr( title=substr(request->title,0,14); //截取title长度
for( i = 0 ; i=0; i=0;i<44;$i++)\{
// a r r = \[ 1 , 5 , 9 , 13 , 17 , 21 , 25 , 29 , 33 , 37 , 41 \] ; i f ( arr = \[1,5,9,13,17,21,25,29,33,37,41\]; if( arr=\[1,5,9,13,17,21,25,29,33,37,41\];if(i%4==0|| i e c h o ′ < d i v s t y l e = " w i d t h : 155 p x ; f l o a t : r i g h t ; m a r g i n : 1 p x 017 p x 8 p x ; p a d d i n g − l e f t : 3 p x " > < d i v > < i m g s t y l e = “ w i d t h : a u t o ; m a x − w i d t h : 95 i%3==0){ echo '
’. KaTeX parse error: Expected ‘EOF’, got ‘}‘ at position 121: …’; }̲else{ …cc->getBarcodePNG($request->num, r e q u e s t − > t y p e ) . ′ “ a l t = “ b a r c o d e “ / > < / d i v > < d i v s t y l e = “ w i d t h : 155 p x ; t e x t − a l i g n : c e n t e r “ > ′ . request->type) . '” alt=”barcode” />
’.$title.’…New
MADE IN CHINA
’;
}
}
}
}
调用接口:http://192.168.22.234/index.php/barcode?fn_sku=X001Z2ZLCC&num=454661&type=C128A&title=Attoomasauasas Mesh Showesasasadasdsadr…New
二维码生成
use Milon\Barcode\DNS1D;
use Milon\Barcode\DNS2D;
//生成二维码
public function qrCode(){
KaTeX parse error: Expected ‘EOF’, got ‘&’ at position 49: …br>
&̲nbsp; &nbs…cc->getBarcodeSVG(“AZ:X4CTAAHKI5A6TEYW9RCJNFOFWI”, “DATAMATRIX”);
}
还没有评论,来说两句吧...