Php generates QR Code business cards

Source: Internet
Author: User
Tags vcard
Php generates QR Code business cards
[PHP] code

  1. /*
  2. * Generate a QR code business card in php
  3. * Api Google
  4. * Google api QR code generation [QRcode can store any text of a maximum of 4296 letters/numbers. for details, see the QR code data format]
  5. * @ Param string $ information contained in the chlorophyll QR code, which can be numbers, characters, binary information, and Chinese characters. The data type cannot be mixed and must pass through the UTF-8 URL-encoded. if the information to be passed exceeds 2 K bytes, use the POST method
  6. * @ Param int $ widhtHeight: set the size of the generated QR code
  7. * @ Param string $ EC_level: the error correction level is optional. the QR code supports four levels of error correction, which is used to restore lost, read, fuzzy, and data.
  8. * L-default: 7% of lost data can be identified.
  9. * M-identifies 15% of data loss
  10. * Q-identifies 25% of data loss
  11. * H-identifies 30% of data loss
  12. * @ Param int $ the distance between the QR code generated by margin and the image border
  13. * Qr code business card format --- vcard
  14. * The format is as follows:
  15. BEGIN: VCARD
  16. VERSION: 3.0
  17. FN: User name
  18. TEL; CELL; VOICE: 15201280000
  19. TEL; WORK; VOICE: 010-62100000
  20. TEL; WORK; FAX: 010-62100001
  21. EMAIL; PREF; INTERNET: lzw # lzw. me
  22. URL: http://lzw.me
  23. OrG: Zhiwen Studio
  24. ROLE: Product Department
  25. TITLE: CTO
  26. ADR; WORK; POSTAL: No. 35, Beisihuan Middle Road, Chaoyang district, Beijing; 100101
  27. REV: 2012-12-27T08: 30: 02Z
  28. END: VCARD
  29. If you want to customize the required format in more detail, you need to learn more about the format standard of vcard.
  30. */
  31. $ Vcard = array (
  32. 'Vname' => 'username ',
  33. 'Vtel' => '123 ',
  34. 'Vemail' => 'playby @ 163.com ',
  35. 'Vaddress' => 'chaoyang district, Beijing ',
  36. );
  37. GenerateQRfromGoogle ($ vcard );
  38. Function generateQRfromGoogle ($ vcard, $ widhtHeight = '000000', $ EC_level = 'l', $ margin = '0 ')
  39. {
  40. If ($ vcard ){
  41. $ Chlorophyll = "BEGIN: VCARD \ nVERSION: 3.0". // vcard header information
  42. "\ NFN: '". $ vcard ['vname'].
  43. "\ NTEL:". $ vcard ['vtel'].
  44. "\ NEMAIL:". $ vcard ['vemail'].
  45. "\ NADR:". $ vcard ['vaddress'].
  46. "\ NEND: VCARD"; // vcard tail information
  47. Echo '';
  48. }
  49. }
  50. ?>

Php

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.