LoginSignup
2

More than 3 years have passed since last update.

posted at

QRコードを生成するコマンド

インストール

# CentOS 6 で確認 (CentOS 5には無い)
yum install -y qrencode
# Ubuntu 20.04 で確認
apt install -y qrencode

使い方

画像にする場合
qrencode -o a.png "http://qiita.com"
端末に出力する場合
qrencode -t ansi "http://qiita.com"

php で実行して結果を表示

qr.php
<?php
function echo_qrcode($str) {
        $command = sprintf('/usr/bin/qrencode "%s" -o -', $str);
        $qrcode = `$command`;
        header("Content-type: image/png");
        echo $qrcode;
}
echo_qrcode("https://www.google.com/search?client=ubuntu&hs=M8b&channel=fs");

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
2