lib.export.php
来自「通达OA2007SE源代码 非常好的」· PHP 代码 · 共 51 行
PHP
51 行
<?
function convert2vcf ($data)
{
$ldap_key = array ('name' => 'FN', 'email' => 'EMAIL;PREF;INTERNET', 'street' => 'ADR;WORK', 'work' => 'TITLE');
$ldapfile = 'BEGIN:VCARD
VERSION:2.1
';
foreach ($data as $key => $value)
{
if ((($key != 'city') AND ($key != 'state')))
{
$testo = (($key == 'street') ? (((((';;'.$data['street']).';').$data['city']).';;;').$data['state']) : $value);
if (ereg ('[@,
,\\(,\\),;,:]', $value))
{
$testo = urlencode ($testo);
$testo = ereg_replace ('\\+', ' ', $testo);
$testo = ereg_replace ('%', '=', $testo);
$testo = chunk_split ($testo, 76, '=
');
$testo = substr ($testo, 0, (strlen ($testo) - 3));
($ldapfile .= ($ldap_key[$key].(((''.';ENCODING=QUOTED-PRINTABLE:').$testo).'
')));
continue;
}
else
{
($ldapfile .= ($ldap_key[$key].(((''.':').$testo).'
')));
continue;
}
continue;
}
}
($ldapfile .= (('REV:'.date ('Ymd\\This', time ())).'
'));
($ldapfile .= 'END:VCARD');
return $ldapfile;
}
function export2ou ($data)
{
$file = convert2vcf ($data);
$filename = (empty ($data['name']) ? 'Address' : $data['name']);
header ((((''.'Content-Type: application/outlook
Content-Disposition: attachment; filename="').$filename).'.vcf"
Content-Description: PHP Generated Data
'));
print $file;
}
?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?