作者 lyh

gx

... ... @@ -123,6 +123,7 @@ class LoginController extends BaseController
$templateModel = new Template();
$list = $templateModel->list();
foreach ($list as $k => $v){
$html = $v['html'];
// 使用正则表达式和 preg_match_all 函数来匹配多个 img 标签的 src 值
preg_match_all('/\"https:\/\/ecdn6.globalso.com\/public\/template\/(.*?)\"/', $v['html'], $matches);
if (!empty($matches[1])) {
... ... @@ -131,12 +132,13 @@ class LoginController extends BaseController
foreach ($srcValues as $srcValue) {
$hash = basename($srcValue);
$image_info = $imageModel->read(['hash'=>$hash]);
var_dump($image_info);
if($image_info !== false){
$path = basename($image_info['path']);
$data['html'] = str_replace(
$hash,
$path,
$v['html']
$html
);
$templateModel->edit(['html'=>$data['html']],['id'=>$v['id']]);
}
... ...