Example of implementing a QR code containing your own business card in php
- Include ("phpqrcode/phpqrcode. php ");
- $ Url = 'In in: VCARD
- VERSION: 3.0
- FN: James
- NICKNAME: zhangsan
- ORG: level limited internet companies
- TITLE: PHP application development engineer
- TEL; TYPE = work: *** 44301
- TEL: 158 ***** 4233
- EMAIL: zhangsan @ ***. *** .com.cn
- END: VCARD ';
- QRcode: png ($ url, "B .png ");
- ?>
-
Note: The above method requires you to download the phpqrcode file. In addition, Google APIs can also be used.
$ Vname = 'Zhang San ';
- $ Vtel = '000000**** 158 ';
- $ Nickname = 'hangsan ';
- $ Company = 'level limited internet company ';
- $ Title = 'php application development engineer ';
- $ Email = "zhangsan @ ***. *** .com.cn ";
- $ Worktel = '*** 44301 ';
- GenerateQRfromGoogle ($ vname, $ vtel, $ nickname, $ company, $ title, $ worktel, $ email );
Function generateQRfromGoogle ($ vname, $ vtel, $ nickname, $ company, $ title, $ worktel, $ email, $ widhtHeight = '2016', $ EC_level = 'l ', $ margin = '0 ')
- {
- If ($ vname & $ vtel ){
- $ Chlorophyll = "BEGIN: VCARD \ nVERSION: 3.0 \ n". // vcard header information
- "FN: $ vname \ n ".
- "NICKNAME: $ nickname \ n ".
- "ORG: $ company \ n ".
- "TEL: $ vtel \ n ".
- "TITLE: $ title \ n ".
- "TEL; WORK; VOICE: $ worktel \ n ".
- "EMAIL: $ email \ n ".
- "END: VCARD"; // vcard tail information
- Echo $ chlorophyll; echo "\ n ";
- Echo 'alt = "QR code" widhtHeight = "'. $ widhtHeight.'" widhtHeight = "'. $ widhtHeight.'"/> ';
- }
- }
- ?>
: |