0
我正在导入带有附件的电子邮件,然后将它们保存到临时文件夹。问题是,一旦文件被保存到最终目录中,它就没有扩展名。PHP - 识别附件文件扩展名
如何获取附件的文件扩展名,然后将其附加到文件名?
/* iterate through each attachment and save it */
foreach($attachments as $attachment)
{
if($attachment['is_attachment'] == 1)
{
$filename = $overview[0]->subject;
if(empty($filename)) $filename = $attachment['filename'];
if(empty($filename)) $filename = time() . ".dat";
/* prefix the email number to the filename in case two emails
* have the attachment with the same file name.
*/
$fp = fopen('./'.$holidex.'/'.$email_number."-".$filename, "w+");
fwrite($fp, $attachment['attachment']);
fclose($fp);
}
}
什么变量$''附件内容?你能打印吗? –