我是PHP&的新手。想使用http://sourceforge.net/projects/phpqrcode/中的PHP QR码库我下载了zip文件但不知道将这些内容放在Linux中的哪个位置供我的PHP识别。
我可以把它们放在任何地方,或者说它们放在哪里的良好做法&安装?
由于
答案 0 :(得分:1)
从INSTALL文件中,它似乎很简单:
解压缩lib文件夹中的文件(例如/ var / www / lib / qrlib)
从PHP页面,包含qrlib文件
你已经完成了
以下是PHP页面位于/ var / www文件夹中的代码示例。将此代码写在/var/www/qrtest.php文件中,并尝试从浏览器访问它。
<?php
//include only that one, rest required files will be included from it
include "./lib/qrlib/qrlib.php"
//write code into file, Error corection lecer is lowest, L (one form: L,M,Q,H)
//each code square will be 4x4 pixels (4x zoom)
//code will have 2 code squares white boundary around
QRcode::png('PHP QR Code :)', 'test.png', 'L', 4, 2);
//same as above but outputs file directly into browser (with appr. header etc.)
//all other settings are default
//WARNING! it should be FIRST and ONLY output generated by script, otherwise
//rest of output will land inside PNG binary, breaking it for sure
QRcode::png('PHP QR Code :)');
//show benchmark
QRtools::timeBenchmark();
//rebuild cache
QRtools::buildCache();
//code generated in text mode - as a binary table
//then displayed out as HTML using Unicode block building chars :)
$tab = $qr->encode('PHP QR Code :)');
QRspec::debug($tab, true);
?>