正在显示
1 个修改的文件
包含
26 行增加
和
9 行删除
@@ -44,15 +44,8 @@ class Body { | @@ -44,15 +44,8 @@ class Body { | ||
44 | 44 | ||
45 | $this->fileSavePath = $fileSavePath; | 45 | $this->fileSavePath = $fileSavePath; |
46 | 46 | ||
47 | - // 这个是描述特殊文本 | ||
48 | - if(strpos($body,'This is a multi-part message in MIME format.')===0){ | ||
49 | - $body = trim($body,'This is a multi-part message in MIME format.'); | ||
50 | - $body = trim($body); | ||
51 | - } | ||
52 | - if(strpos($body,'This is a multipart message in MIME format.')===0){ | ||
53 | - $body = trim($body,'This is a multipart message in MIME format.'); | ||
54 | - $body = trim($body); | ||
55 | - } | 47 | + $body = $this->ltrimText($body); |
48 | + | ||
56 | 49 | ||
57 | // 163 有 | 50 | // 163 有 |
58 | if(strpos($body,'------=_Part')!==false){ | 51 | if(strpos($body,'------=_Part')!==false){ |
@@ -106,6 +99,30 @@ class Body { | @@ -106,6 +99,30 @@ class Body { | ||
106 | 99 | ||
107 | } | 100 | } |
108 | 101 | ||
102 | + | ||
103 | + public function ltrimText($body){ | ||
104 | + $bodyMiaoSuText = [ | ||
105 | + 'This is a multi-part message in MIME format.', | ||
106 | + 'This is a multipart message in MIME format.', | ||
107 | + 'This is a MIME message. If you are reading this text, you may want to | ||
108 | +consider changing to a mail reader or gateway that understands how to | ||
109 | +properly handle MIME multipart messages.', | ||
110 | +// 'This is a MIME message.' | ||
111 | + ]; | ||
112 | + | ||
113 | + foreach ($bodyMiaoSuText as $str){ | ||
114 | + // 这个是描述特殊文本 | ||
115 | + if(strpos($body,$str)===0){ | ||
116 | + $body = ltrim($body,$str); | ||
117 | + $body = trim($body); | ||
118 | + } | ||
119 | + } | ||
120 | + | ||
121 | + return $body; | ||
122 | + | ||
123 | + } | ||
124 | + | ||
125 | + | ||
109 | /** | 126 | /** |
110 | * 获取标签 | 127 | * 获取标签 |
111 | * @param $body | 128 | * @param $body |
-
请 注册 或 登录 后发表评论