当前位置: 移动技术网 > IT编程>开发语言>PHP > PHP实现生成vcf vcard文件功能类定义与使用方法详解【附demo源码下载】 原创

PHP实现生成vcf vcard文件功能类定义与使用方法详解【附demo源码下载】 原创

2017年09月07日  | 移动技术网IT编程  | 我要评论

憔悴的志愿兵,取款被办成存款,外域美食家

本文实例讲述了php实现生成vcf vcard文件功能类定义与使用方法。分享给大家供大家参考,具体如下:

前面介绍了,这里再来研究一下vcf文件的生成方法。

vcf格式是windows系统中outlook的名片存储格式,打开vcf格式需要使用手机的相应配套软件,使用outlook也可以打开vcf文件。

手机通讯录保存的文件格式也是vcf格式。这里就来给出一个使用php生成vcf格式文件的实例。

具体代码如下:

<?php
 date_default_timezone_set('prc');
 include("vcardifl.class.php");
 $ardata=array();
 $ardata["filename"]='jb51_vcf_demo';
 $ardata["saveto"]='tmpfile';
 $ardata["vcard_birtda"]=date('y-m-d',time());
 $ardata["vcard_f_name"]='tom';
 $ardata["vcard_s_name"]='green';
 $ardata["vcard_uri"]='//www.jb51.net';
 $ardata["vcard_nickna"]='coder';
 $ardata["vcard_note"]='write code';
 $ardata["vcard_cellul"]='1388888888x';
 $ardata["vcard_compan"]='blue best comp';
 $ardata["vcard_p_pager"]='no';
 $ardata["vcard_c_mobile"]='1388888888x';
 $ardata["vcard_h_addr"]='blue best comp';
 $ardata["vcard_h_city"]='xuzhou';
 $ardata["vcard_h_coun"]='china';
 $ardata["vcard_h_fax"]='no';
 $ardata["vcard_h_mail"]='jb51@fmail.com';
 $ardata["vcard_h_phon"]='1388888888x';
 $ardata["vcard_h_zip"]='jb51';
 $ardata["vcard_h_uri"]='http://tools.jb51.net';
 $ardata["vcard_w_addr"]='star shine';
 $ardata["vcard_w_city"]='xuzhou';
 $ardata["vcard_w_coun"]='china';
 $ardata["vcard_w_fax"]='no';
 $ardata["vcard_w_mail"]='starshine@fmail.com';
 $ardata["vcard_w_phon"]='1366666666x';
 $ardata["vcard_w_role"]='boss';
 $ardata["vcard_w_titl"]='demo test';
 $ardata["vcard_w_zip"]='starzip';
 $ardata["vcard_w_uri"]='http://www.simpletest.com';
 $vcfdemo=new vcardifl($ardata);
 $vcfdemo->createvcard();
 echo $vcfdemo->savevcard()?'创建成功!':'创建失败!';
?>

运行代码可在tmpfile文件夹下创建一个相应的jb51_vcf_demo.vcf文件,如下图所示:

附:vcardifl.class.php完整代码点击此处。

更多关于php相关内容感兴趣的读者可查看本站专题:《php文件操作总结》、《php数组(array)操作技巧大全》、《php基本语法入门教程》、《php面向对象程序设计入门教程》、《php网络编程技巧总结》及《php字符串(string)用法总结

希望本文所述对大家php程序设计有所帮助。

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网