use dosamigos\qrcode\QrCode;
public function actionQrcode()
{
return QrCode::png('hello');
}
According to the original example, the picture cannot be displayed
習慣沉默2017-05-16 13:08:35
use dosamigos\qrcode\QrCode;
public function actionQrcode()
{
header('Content-Type: image/png');
ob_clean();
return QrCode::png('hello');
}
Find the problem and add this to solve it
Thank you everyone for the solutions
我想大声告诉你2017-05-16 13:08:35
I haven’t used it, but you can check what the response header content-Type is and whether it is image/png
巴扎黑2017-05-16 13:08:35
Use incorrectly!
The parameter should be a url link---note that the link should be urldecoded
$url = urldecode($url);
QRcode::png($url);
世界只因有你2017-05-16 13:08:35
use dosamigos\qrcode\QrCode;
use yii\web\Response;
public function actionQrcode()
{
\Yii::$app->response->format = Response::FORMAT_RAW;
return QrCode::png('hello');
}