5 回答

TA貢獻1788條經驗 獲得超4個贊
我使用 Laravel7 并找到了解決方案。安裝 QR“simplesoftwareio/simple-qrcode”后:“^3.0”
(不要在 config/app.php 中添加這個)'providers' 和 'aliases' 在 config/app.php
#'providers' => [SimpleSoftwareIO\QrCode\QrCodeServiceProvider::class,], #'aliases' => ['QrCode' => SimpleSoftwareIO\QrCode\Facades\QrCode::class,],
嘗試在刀片模板 test.blade.php 中添加 qr
{!! QrCode::size(250)->generate('www.google.com'); !!}
它對我有用

TA貢獻1829條經驗 獲得超7個贊
config\app.php
在這樣的更新下:
供應商:
SimpleSoftwareIO\QrCode\ServiceProvider::class,
別名:
'QrCode' => SimpleSoftwareIO\QrCode\Facade::class,
或者刪除此提供程序和 .

TA貢獻1794條經驗 獲得超8個贊
沒有一個答案對我有用。以下是我如何使用 PHP8 在 Laravel 9 上修復它。
首先,我們必須安裝 PHP GD 庫。
sudo apt-get install php-gd
安裝 Simple QRcodde 版本 4 或更高版本。
composer require simplesoftwareio/simple-qrcode "~4" --with-all-dependencies
無需更改 config/app.php。
我們可以簡單地在刀片視圖文件上使用它:
{!! QrCode::size(250)->generate('mailto:[email protected]'); !!}

TA貢獻1893條經驗 獲得超10個贊
首先使用此命令安裝作曲家
composer require simplesoftwareio/simple-qrcode
在您的 web.php 文件中添加以下內容
? ? Route::get('qr-code-g', function () {
? ? \QrCode::size(500)
? ? ? ? ? ? ->format('png')
? ? ? ? ? ? ->generate('www.google.com', public_path('images/qrcode.png'));
return view('qrCode');
});
在名為qrcode.blade.php的刀片文件中必須如下所示
<!DOCTYPE html>
<html>
? ? <head>
? ? ? ? <title>QR code Generator</title>
? ? </head>
<body>
? ? <div class="visible-print text-center">
? ? ? ? <h1>Laravel 7 - QR Code Generator Example</h1>?
? ? ? ? {!! QrCode::size(250)->generate('www.google.com'); !!}?
? ? </div>
</body>
</html>
使用 laravel 7 時無需在config/app.php中添加別名和提供者
需要運行以下命令來安裝 imagemagick
sudo apt-get update
sudo apt-get install -y imagemagick php-imagick
您可以檢查安裝以運行命令
php -m | grep imagick
如果安裝成功,會顯示如下
imagick
然后,需要重新啟動您的 apache 服務器或重新啟動您的系統它會正常工作。
- 5 回答
- 0 關注
- 541 瀏覽
添加回答
舉報