作者 刘锟

update

@@ -145,23 +145,32 @@ class Temp extends Command @@ -145,23 +145,32 @@ class Temp extends Command
145 145
146 $content = ''; 146 $content = '';
147 if ($data[4] ?? '') { 147 if ($data[4] ?? '') {
148 - //处理内容中的图片  
149 - preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[4], $result); 148 + //处理内容中的pdf文件
  149 + preg_match_all('/<a\s+[^>]*?href\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[4], $result);
150 if ($result[2] ?? []) { 150 if ($result[2] ?? []) {
151 - foreach ($result[2] as $img) {  
152 - $new_img = check_remote_url_down($img, $project_id, $domain, 1);  
153 - $new_img && $data[4] = str_replace($img, $new_img, $data[4]); 151 + foreach ($result[2] as $pdf) {
  152 + $new_img = check_remote_url_down($pdf, $project_id, $domain, 1);
  153 + $new_img && $data[4] = str_replace($pdf, $new_img, $data[4]);
154 } 154 }
155 } 155 }
156 156
  157 + //处理内容中的图片
  158 +// preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[4], $result);
  159 +// if ($result[2] ?? []) {
  160 +// foreach ($result[2] as $img) {
  161 +// $new_img = check_remote_url_down($img, $project_id, $domain, 1);
  162 +// $new_img && $data[4] = str_replace($img, $new_img, $data[4]);
  163 +// }
  164 +// }
  165 +
157 //处理内容中的视频 166 //处理内容中的视频
158 - preg_match_all('/<source\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[4], $result_video);  
159 - if ($result_video[2] ?? []) {  
160 - foreach ($result_video[2] as $video) {  
161 - $new_video = check_remote_url_down($video, $project_id, $domain, 1);  
162 - $new_video && $data[4] = str_replace($video, $new_video, $data[4]);  
163 - }  
164 - } 167 +// preg_match_all('/<source\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[4], $result_video);
  168 +// if ($result_video[2] ?? []) {
  169 +// foreach ($result_video[2] as $video) {
  170 +// $new_video = check_remote_url_down($video, $project_id, $domain, 1);
  171 +// $new_video && $data[4] = str_replace($video, $new_video, $data[4]);
  172 +// }
  173 +// }
165 174
166 $content = $data[4]; 175 $content = $data[4];
167 } 176 }