4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

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

Posted at

インストール

# 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");
4
3
0

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
  3. You can use dark theme
What you can do with signing up
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?