...
|
...
|
@@ -151,7 +151,7 @@ class Body { |
|
|
|
|
|
// 有附件的情况
|
|
|
preg_match('/boundary="(.*)"/Ui',$body,$boundary);
|
|
|
if($boundary[0]??''){
|
|
|
if(!empty($boundary[0])){
|
|
|
$body = str_replace($boundary[0],'',$body);
|
|
|
// $body = mb_substr($body,mb_strpos($body,$boundary[0])+strlen($boundary[0]),99999999999);
|
|
|
}
|
...
|
...
|
@@ -232,7 +232,8 @@ class Body { |
|
|
}
|
|
|
|
|
|
// 先匹配留存文件名称
|
|
|
preg_match('/filename="(\w?.*)"/',$item,$filename);
|
|
|
$filename = '';
|
|
|
preg_match('/filename="(\w?.*)"/U',$item,$filename);
|
|
|
if(!empty($filename[1])){
|
|
|
// $filename = MailFun::decodeMimeStr($filename[1]);
|
|
|
$filename = mb_decode_mimeheader($filename[1]);
|
...
|
...
|
@@ -318,7 +319,7 @@ class Body { |
|
|
|
|
|
$data['filename'] = $this->file_save_name($item['body'],'filename');
|
|
|
$data['name'] = $this->file_save_name($item['body'],'name');
|
|
|
$data['name'] = $data['name'] ? : ($item['name']??$filename);
|
|
|
$data['name'] = $data['name'] ? : (empty($item['name'])?$filename:$item['name']);
|
|
|
$data['filename'] = $data['filename'] ? : $data['name'];
|
|
|
|
|
|
// 是否有文件名
|
...
|
...
|
@@ -396,7 +397,7 @@ class Body { |
|
|
// 获取文件名称
|
|
|
private function file_save_name(&$body,$tag){
|
|
|
preg_match('/'.$tag.'="[(\S\W.*\s.*)]{1,}"/i',$body,$result);
|
|
|
if($result[0]??''){
|
|
|
if(!empty($result[0])){
|
|
|
$body = str_replace($result[0],'',$body);
|
|
|
}
|
|
|
$val = trim(str_replace([$tag.'=','"',"'"],'',$result[0]??''));
|
...
|
...
|
|