A detailed explanation of how PHP is implemented to generate a VCF vcard file

Source: Internet
Author: User
Tags class definition vcard import database
How does PHP implement the Generate VCF vcard file? This article mainly introduced the PHP implementation of the VCF vcard file function class definition and use method, combined with the specific example form analysis of the VCF vcard function class specific definition and use, and with the VCardIFL.class.php class file source for the reader to download the reference. Need friends can refer to, hope to help you.

The method of reading the VCF file by PHP is described earlier, and the method of generating VCF file is discussed here.

The VCF format is the business card storage format for Outlook in Windows systems, and opening the VCF format requires the appropriate companion software for your phone, and you can also open the VCF file by using Outlook.

The file format saved by phone Address Book is also in VCF format. Here is an example of using PHP to generate a VCF format file.

The specific code is as follows:

<?php date_default_timezone_set (' PRC '); Include ("VCardIFL.class.php"); $arData =array (); $arData ["FileName"]= ' 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"]= ' http://www.php.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"]= ' php@mail.com '; $arData ["Vcard_h_phon"]= ' 1388888888x '; $arData ["Vcard_h_zip"]= "; $arData ["Vcard_h_uri"]= ' http://php.cn '; $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"]= ' * * * * @mail. 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.***.com '; $vcfdemo =new VCARDIFL ($arData); $vcfdemo->createvcard (); echo $vcfdemo->savevcard ()? ' Create success! ': ' Creation failed! ';? >

Run the code to create a corresponding VCF_DEMO.VCF file under the Tmpfile folder, as shown in:

Related recommendations:

A detailed explanation of PHP XML file additions and deletions

A detailed explanation of how PHP implements the CSV file import database

A detailed explanation of how PHP exports the database to a CSV file

Related Article

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.