ぱふぅ家のホームページというサイトで、QRコード生成の方法を見つけた。

実際のライブラリは、swetake.comで配布してますし、ぱふぅ家のホームページのサンプルはライブラリ解凍時に作成されるサンプル(sample.php)と作法が違うためなのか動作しませんでした。

ので、sample.phpを参考にしごく簡単ですが、テキストボックスに入力した文字列をQRコード化するサンプルを作成しました。

動作するサンプルは、コチラです。

◆test.php


<?php
require("./qrcode_img.php");

Header("Content-type: image/png");
if( isset($_POST['data']) && $_SERVER['HTTP_REFERER'] == "http://typista.dip.jp/test/qrcode_php0.50beta10/test.html" ) {
$data=stripslashes($_POST['data']);
$z=new Qrcode_image;
$z->qrcode_image_out($data,"png");
} else {
echo "error!";
}
?>

◆test.html
改行コード対応のためtextarea化(2007/04/06)


<form action="http://typista.dip.jp/test/qrcode_php0.50beta10/test.php" method="POST">
<textarea name="data" ></textarea>
<input type="submit" value="make" />
</form>