{"id":1901,"date":"2013-11-27T14:42:00","date_gmt":"2013-11-27T06:42:00","guid":{"rendered":"http:\/\/www.hiheng.com\/blog\/?p=1901"},"modified":"2015-03-11T15:31:55","modified_gmt":"2015-03-11T07:31:55","slug":"php-qr-code%e7%b1%bb%e5%ba%93%e7%94%9f%e6%88%90%e4%ba%8c%e7%bb%b4%e7%a0%81","status":"publish","type":"post","link":"http:\/\/www.hiheng.com\/blog\/?p=1901","title":{"rendered":"PHP QR Code\u7c7b\u5e93\u751f\u6210\u4e8c\u7ef4\u7801"},"content":{"rendered":"<p>\u7531\u4e8e\u4e8c\u7ef4\u7801\u88ab\u5e7f\u6cdb\u4f7f\u7528\uff0c\u73b0\u5728\u5728web\u5f00\u53d1\u4e2d\u4e0d\u5f97\u4e0d\u7ecf\u5e38\u751f\u6210\u5404\u79cd\u4e8c\u7ef4\u7801\u3002\u53ef\u4ee5\u5229\u7528PHP\u7c7b\u5e93\u201cPHP QR Code\u201d\u6765\u751f\u6210\u4e00\u79cd\u5e38\u89c1\u7684\u4e8c\u7ef4\u7801\u2014\u2014QR\u7801\u3002<\/p>\n<p>\u7c7b\u5e93\u4e0b\u8f7dURL:\u00a0<a href=\"http:\/\/phpqrcode.sourceforge.net\/\" target=\"_blank\">http:\/\/phpqrcode.sourceforge.net\/<\/a> <\/p>\n<p>qrlib.php \u662f\u5b8c\u6574\u7248\uff0c\u5b98\u65b9\u7684\u8c03\u7528\u5b9e\u4f8b\uff1a<\/p>\n<pre class=\"brush: php; gutter: true; first-line: 1; highlight: []; html-script: false\">\r\nQRcode::png(&#039;code data text&#039;, &#039;filename.png&#039;); \/\/ creates file \r\n\r\nQRcode::png(&#039;some othertext 1234&#039;); \/\/ creates code image and outputs it directly into browser\r\n<\/pre>\n<p>phpqrcode.php \u662f\u5408\u5e76\u7248\uff0c\u53ea\u6709\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f46\u751f\u6210\u901f\u5ea6\u8f83\u6162\u4e14\u4e0d\u592a\u51c6\u786e\u3002\u4f7f\u7528\u65b9\u6cd5\uff1a<\/p>\n<pre class=\"brush: php; gutter: true; first-line: 1; highlight: []; html-script: false\">\r\n\/\/\r\ninclude &quot;phpqrcode\/phpqrcode.php; \r\n\r\n$data=\u201chttp:\/\/www.hiheng.com\u201d;  \/\/\u4e8c\u7ef4\u7801\u6570\u636e\r\n\r\n$filename = $errorCorrectionLevel.&#039;|&#039;.$matrixPointSize.&#039;.png&#039;; \/\/\u751f\u6210\u7684\u6587\u4ef6\u540d\r\n\r\n$errorCorrectionLevel = &#039;L&#039;;   \/\/\u7ea0\u9519\u7ea7\u522b L | M | Q | H\r\n$matrixPointSize = 4;    \/\/\u6bcf\u4e2a\u9ed1\u70b9\u7684\u50cf\u7d20 1~10\r\nQRcode::png($data,$filename,$errorCorrectionLevel,$matrixPointSize);\r\n\/\/\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u7531\u4e8e\u4e8c\u7ef4\u7801\u88ab\u5e7f\u6cdb\u4f7f\u7528\uff0c\u73b0\u5728\u5728web\u5f00\u53d1\u4e2d\u4e0d\u5f97\u4e0d\u7ecf\u5e38\u751f\u6210\u5404\u79cd\u4e8c\u7ef4\u7801\u3002\u53ef\u4ee5\u5229\u7528PHP\u7c7b\u5e93\u201cPHP QR Code\u201d\u6765\u751f\u6210\u4e00\u79cd\u5e38\u89c1\u7684\u4e8c\u7ef4\u7801\u2014\u2014QR\u7801\u3002<\/p>\n<p>\u7c7b\u5e93\u4e0b\u8f7dURL:\u00a0<a href=\"http:\/\/phpqrcode.sourceforge.net\/\" target=\"_blank\">http:\/\/phpqrcode.sourceforge.net\/<\/a> <\/p>\n<p>qrlib.php \u662f\u5b8c\u6574\u7248\uff0c\u5b98\u65b9\u7684\u8c03\u7528\u5b9e\u4f8b\uff1a<\/p>\n<pre class=\"brush: php; gutter: true; first-line: 1; highlight: []; html-script: false\">\r\nQRcode::png('code data text', 'filename.png'); \/\/ creates file \r\n\r\nQRcode::png('some othertext 1234'); \/\/ creates code image and outputs it directly into browser\r\n<\/pre>\n<p>phpqrcode.php \u662f\u5408\u5e76\u7248\uff0c\u53ea\u6709\u4e00\u4e2a\u6587\u4ef6\uff0c\u4f46\u751f\u6210\u901f\u5ea6\u8f83\u6162\u4e14\u4e0d\u592a\u51c6\u786e\u3002\u4f7f\u7528\u65b9\u6cd5\uff1a<\/p>\n<pre class=\"brush: php; gutter: true; first-line: 1; highlight: []; html-script: false\">\r\n\/\/\r\ninclude &quot;phpqrcode\/phpqrcode.php; \r\n\r\n$data=\u201chttp:\/\/www.hiheng.com\u201d;  \/\/\u4e8c\u7ef4\u7801\u6570\u636e\r\n\r\n$filename = $errorCorrectionLevel.'|'.$matrixPointSize.'.png'; \/\/\u751f\u6210\u7684\u6587\u4ef6\u540d\r\n\r\n$errorCorrectionLevel = 'L';   \/\/\u7ea0\u9519\u7ea7\u522b L | M | Q | H\r\n$matrixPointSize = 4;    \/\/\u6bcf\u4e2a\u9ed1\u70b9\u7684\u50cf\u7d20 1~10\r\nQRcode::png($data,$filename,$errorCorrectionLevel,$matrixPointSize);\r\n\/\/\r\n<\/pre>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[152,11],"tags":[122,132],"class_list":["post-1901","post","type-post","status-publish","format-standard","hentry","category-php","category-11","tag-php","tag-132"],"_links":{"self":[{"href":"http:\/\/www.hiheng.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1901","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.hiheng.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.hiheng.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.hiheng.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.hiheng.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1901"}],"version-history":[{"count":7,"href":"http:\/\/www.hiheng.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1901\/revisions"}],"predecessor-version":[{"id":1908,"href":"http:\/\/www.hiheng.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1901\/revisions\/1908"}],"wp:attachment":[{"href":"http:\/\/www.hiheng.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1901"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.hiheng.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1901"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.hiheng.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1901"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}