laravel條形碼 二維碼 生成
-
composer require milon/barcode 5.3
class CodeController extends Controller
{
//
public function yicode(Request $request){
$cc = new DNS1D();
cc->getBarcodePNG(
request->type);
return $img;
}
}
num為傳入的號碼 ,type為條形碼型別
PS:http://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();
request->title,0,14); //擷取title長度
for(
i<44;$i++){
//
i%4==0||
cc->getBarcodePNG($request->num,
request->fn_sku.’
}
}
}
}
二維碼生成
use Milon\Barcode\DNS1D;
use Milon\Barcode\DNS2D;
//生成二維碼
public function qrCode(){
KaTeX parse error: Expected 'EOF', got '&' at position 49: …br><br><br><br>&̲nbsp; &nbs…cc->getBarcodeSVG(“AZ:X4CTAAHKI5A6TEYW9RCJNFOFWI”, “DATAMATRIX”);
}