-
-
include("phpqrcode/phpqrcode.php");
- $url='BEGIN:VCARD
- VERSION:3.0
- FN: 张三
- NICKNAME: zhangsan
- ORG: Horizontal Limited Internet Company
- TITLE:PHP application development engineer
- TEL;TYPE=work:***44301
- TEL:158****4233
- EMAIL:zhangsan@***.***.com.cn
- END:VCARD';
- QRcode ::png($url,"b.png");
- ?>
-
Copy code
Note: The above method requires downloading the phpqrcode file.
In addition, you can also use the Google API method.
-
-
$vname = 'Zhang San';
- $vtel = '158****4233';
- $nickname='zhangsan';
- $company=' Horizontal 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 ='200',$EC_level='L',$margin='0')
- {
- if($vname&&$vtel){
- $chl = "BEGIN:VCARDnVERSION:3.0n ". //vcard header information
- "FN:$vnamen".
- "NICKNAME:$nicknamen".
- "ORG:$companyn".
- "TEL:$vteln".
- "TITLE:$titlen".
- "TEL ;WORK;VOICE:$workteln".
- "EMAIL:$emailn".
- "END:VCARD"; //vcard tail information
- echo $chl;echo "n";
- echo ' alt="QR code" widhtHeight="'.$widhtHeight.'" widhtHeight="'.$widhtHeight.'"/>';
- }
- }
- ?>> ;
-
Copy code
Rendering:
|