Home > Backend Development > PHP Tutorial > Example of php implementing a QR code containing your own business card

Example of php implementing a QR code containing your own business card

WBOY
Release: 2016-07-25 08:58:40
Original
1175 people have browsed it
  1. include("phpqrcode/phpqrcode.php");
  2. $url='BEGIN:VCARD
  3. VERSION:3.0
  4. FN: 张三
  5. NICKNAME: zhangsan
  6. ORG: Horizontal Limited Internet Company
  7. TITLE:PHP application development engineer
  8. TEL;TYPE=work:***44301
  9. TEL:158****4233
  10. EMAIL:zhangsan@***.***.com.cn
  11. END:VCARD';
  12. QRcode ::png($url,"b.png");
  13. ?>
Copy code

Note: The above method requires downloading the phpqrcode file.

In addition, you can also use the Google API method.

  1. $vname = 'Zhang San';

  2. $vtel = '158****4233';
  3. $nickname='zhangsan';
  4. $company=' Horizontal Limited Internet Company';
  5. $title='PHP Application Development Engineer';
  6. $email="zhangsan@***.***.com.cn";
  7. $worktel='***44301';
  8. generateQRfromGoogle ($vname,$vtel,$nickname,$company,$title,$worktel,$email);
  9. function generateQRfromGoogle($vname,$vtel,$nickname,$company,$title ,$worktel,$email,$widhtHeight ='200',$EC_level='L',$margin='0')

  10. {
  11. if($vname&&$vtel){
  12. $chl = "BEGIN:VCARDnVERSION:3.0n ". //vcard header information
  13. "FN:$vnamen".
  14. "NICKNAME:$nicknamen".
  15. "ORG:$companyn".
  16. "TEL:$vteln".
  17. "TITLE:$titlen".
  18. "TEL ;WORK;VOICE:$workteln".
  19. "EMAIL:$emailn".
  20. "END:VCARD"; //vcard tail information
  21. echo $chl;echo "n";
  22. echo 'Example of php implementing a QR code containing your own business card alt="QR code" widhtHeight="'.$widhtHeight.'" widhtHeight="'.$widhtHeight.'"/>';
  23. }
  24. }
  25. ?>> ;
Copy code

Rendering: Example of php implementing a QR code containing your own business card



source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template