作者 lyh

hx

... ... @@ -32,9 +32,15 @@ class TestController extends BaseController
<p>&nbsp;</p>
<p><a href="tel:+86%2018825057975">Tel:+86 18825057975</a></p>
<p><a href="mailto:edinguas@gmail.com">Email:edinguas@gmail.com</a></p>';
$newsLogic = new NewsLogic();
$key = $newsLogic->processImage($test);
$this->response('success',Code::SUCCESS,['key'=>$key]);
}
$pattern = '/<img\s+[^>]*src=["\']([^"\']+)["\']/i';
$matches = [];
// Use preg_match_all to find all src attributes
preg_match_all($pattern, $inputString, $matches);
// Return an array of all src URLs found
return $matches[1];
// $newsLogic = new NewsLogic();
// $key = $newsLogic->processImage($test);
$this->response('success',Code::SUCCESS,$matches[1]);
}
}
... ...
... ... @@ -231,6 +231,7 @@ class NewsLogic extends BaseLogic
$base64Data = $matches[2][$index]; // Base64数据
// 解码Base64图片
$decodedData = base64_decode($base64Data);
return $decodedData;
if ($decodedData === false) {
continue; // 如果解码失败,则跳过
}
... ...