手机浏览 RSS 2.0 订阅 膘叔的简单人生 , 腾讯云RDS购买 | 超便宜的Vultr , 注册 | 登陆

QR CODE

首页 > Misc >

一来是好玩,二来是超上个时髦的末班车,用google chart api做了一个QR code。。。

搞了两个路径,一个是直接浏览器看的,第二个是Wap浏览器看的。各取所需。哈哈其实。真的没啥大意义,图个好玩吧?

http://code.google.com/apis/chart/docs/gallery/qr_codes.html

上面这个地址是google chart api里关于qr(二维码)的文档,很方便就可以引用了。默认采用UTF-8字符。

QR codes are a popular type of two-dimensional barcode. They are also known as hardlinks or physical world hyperlinks. QR Codes store up to 4,296 alphanumeric characters of arbitrary text. This text can be anything, for example URL, contact information, a telephone number, even a poem! QR codes can be read by an optical device with the appropriate software. Such devices range from dedicated QR code readers to mobile phones.

QR codes have a different set of required parameters from any other chart. Here are the parameters supported by QR codes:

只要传递最少三个参数就可以了。

cht=qr
chl=我是膘叔
choe=UTF-8

我是膘叔

看到上面这个图没,其实他就是一个很简单的实现。方法就是:

<img src="http://chart.apis.google.com/chart?cht=qr&chs=150x150&choe=UTF-8&chl=%E6%88%91%E6%98%AF%E8%86%98%E5%8F%94%E5%95%8A&" alt="我是膘叔啊" />

OK,一切都解决了。。。。不过建议还是看一下官方的docs页面

【发出一个BUG】如果中文是“我是膘叔”就不正常。如果是“我是膘叔啊”就很正常,看来google的这个接口对中文的支持还不是特别好。

如果是URL的话,一定要用URLencode进入一下处理。。否则会不正常。




本站采用创作共享版权协议, 要求署名、非商业和保持一致. 本站欢迎任何非商业应用的转载, 但须注明出自"易栈网-膘叔", 保留原始链接, 此外还必须标注原文标题和链接.

« 上一篇 | 下一篇 »

发表评论

评论内容 (必填):