【问题标题】:QRCode Generation in LaravelLaravel 中的二维码生成
【发布时间】:2016-04-29 22:34:48
【问题描述】:

我们有 SNIPE IT 资产管理,使用 (\Com\Tecnick\Barcode\Barcode()) QRCODE 生成器。它工作完美并产生

网址:http://xxxxx/xxxx/public/hardware/29/view

现在我们要在该 URL 中添加新参数,如下所示

网址:http://xxxxx/xxxx/public/hardware/29/345/view

【问题讨论】:

  • 请清楚说明您的问题。
  • 我想在路由中动态添加新参数..? EX :Route::get( '{assetId}/{assetTag}/view', [ 'as' => 'view/hardware', 'uses' => 'AssetsController@getView' ] );当它调用 getView 函数时,它调用 QRCOde 路由将生成 QRCode png 数据

标签: laravel laravel-4


【解决方案1】:

假设您使用模型和模型绑定正确地设计了 Laravel 应用程序,您可以执行以下操作。

你需要一条路线:

// Assuming you have a model called Hardware.
$router->get('hardware/{hardware}/view', function (Hardware $hardware) {
    return Barcode::generate('...'); // This is where you'd call the Barcode library you're using
});

【讨论】:

    猜你喜欢
    • 2018-09-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多