Today I saw a user posting a topic, "It's troublesome to type in the URLs on the PC one by one to open them on the mobile. Is there any good way?".
It is true that we are now in the mobile era, and reading on mobile devices will gradually become mainstream. If a website does not have a convenient way for users to read on mobile devices, it would be a bit outdated, so I thought about it and made a "scan code reading" ” function. In fact, it is very simple, just generate a QR code from the URL.
Whether it is generated using PHP or JavaScript, it is easier to use JavaScript in terms of code changes. So let’s use jQuery here. There happens to be an extension of jquery.qrcode.js on the Internet that you can use. It’s also very simple to use, like this:
Then use WeChat, Alipay wallet, etc. to scan it and open it in the mobile browser. It is very convenient. Thanks to the author of jquery.qrcode.js.
The code to generate QR code is as follows:
If the browser does not support HTML5, or you want to configure the size of the image, you can use this method:
Now there is a QR code generated on the right side of each article on the blog, which can be scanned and read on your mobile phone.