Google Charts API(QR码)返回HTTP错误502

问题描述 投票:0回答:2

您是否还有问题,您的QR码不再加载?这是因为Google Charts不再有效。谷歌在过去几天禁用了这项服务!所以,如果你正在努力,这就是原因:

https://groups.google.com/forum/#!topic/Google-chart-api/rZtHTyYgyXI

您需要使用新的Google Charts工具:

https://developers.google.com/chart/

我会弄清楚,如何替换生成QR码的旧实现,让你知道,你如何做到这一点。

qr-code
2个回答
1
投票

几个月前我遇到了这个问题,所以我只做了自己的QR码生成器,我使用了Laravel Framework(PHP)来解决这个问题:

首先我使用了这个库:

simplesoftwareio/simple-qrcode

这当然适用于PHP

像这样的东西:

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Str;
use SimpleSoftwareIO\QrCode\Facades\QrCode;

class QrCodeController extends BaseController
{
    /**
    * @param $uuid
     * @return mixed
     */
    public function generate($parameter) {
        $fileName = $parameter.'.png';
        $file = storage_path()."/".$this->app_directory."/".$fileName;
        QrCode::format('png')->size(1000)->generate($parameter, $file);

        return Response::download($file, $fileName)->deleteFileAfterSend(true);
    }
}

然后我只添加到路由文件:

Route::get('qr/{parameter}', 'QrCodeController@generate');

这只是我解决这个问题的方法。


0
投票

如果您之前只想使用Google之类的网址,我也找到了一个很好的解决方案:

http://goqr.me/api/

问题是,新的Google API没有实施QR码 - 遗憾的是。

© www.soinside.com 2019 - 2024. All rights reserved.