吴伟贤のBlog

Feed Rss

php生成名片(vcard)二维码

02.24.2012, php, by .

使用名片格式vcard:http://en.wikipedia.org/wiki/VCard

2011112315244359

php生成名片格式

<?php
$vname = ‘test’; 
$vtel = ‘13800000000’; 
generateQRfromGoogle($vname,$vtel);
function generateQRfromGoogle($vname,$vtel,$widhtHeight =’150′,$EC_level=’L’,$margin=’0′)
{
    if($vname&&$vtel){ 
       $chl = “BEGIN:VCARD\nVERSION:3.0”. //vcard头信息 
       “\nFN:$vname”. 
       “\nTEL:$vtel”. 
       “\nEND:VCARD”; //vcard尾信息 
       echo ‘<img src=”http://chart.apis.google.com/chart?chs=’.$widhtHeight.’x’.$widhtHeight.’&cht=qr&chld=’.$EC_level.’|’.$margin.’&chl=’.urlencode($chl).'” alt=”QR code” widhtHeight=”‘.$size.'” widhtHeight=”‘.$size.'”/>’;
    }
}
?>

php生成网址二维码:

<?php
$url = “http://www.google.com.hk”;
generateQRfromGoogle($url);
function generateQRfromGoogle($chl,$widhtHeight =’150′,$EC_level=’L’,$margin=’0′)
{
       echo ‘<img src=”http://chart.apis.google.com/chart?chs=’.$widhtHeight.’x’.$widhtHeight.’&cht=qr&chld=’.$EC_level.’|’.$margin.’&chl=’.urlencode($chl).'” alt=”QR code” widhtHeight=”‘.$size.'” widhtHeight=”‘.$size.'”/>’;
}
?>

评论已关闭。