调用二维码的API接口可以直接给文章生成二维码,不需要安装插件,很方便。
1、Google API接口
<img src="https://chart.googleapis.com/chart?cht=qr&chs=200x200&choe=UTF-8&chld=L|1&chl=<?php the_permalink(); ?>" width="200" height="200" alt="<?php the_title(); ?>" />
2、qrserver API接口
<img src="http://api.qrserver.com/v1/create-qr-code/?size=200x200&data=<?php the_permalink(); ?>" alt="<?php the_title(); ?>"/>
国内的话,Google API被屏蔽,qrserver速度很慢。
另外,wordpress的二维码插件,有的也是调用Google和qrserver的接口,有的是生成二维码图片存储在本地服务器,可以参考这篇文章:https://blog.brain1981.com/1362.html