作者 lyh

gx

... ... @@ -123,7 +123,6 @@ 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])) {
... ... @@ -133,14 +132,16 @@ class LoginController extends BaseController
$image_info = $imageModel->read(['hash'=>$srcValue]);
if($image_info !== false){
$path = basename($image_info['path']);
$data['html'] = str_replace(
var_dump($path);
die();
$v['html'] = str_replace(
$srcValue,
$path,
$html
$v['html']
);
$templateModel->edit(['html'=>$data['html']],['id'=>$v['id']]);
}
}
$templateModel->edit(['html'=>$v['html']],['id'=>$v['id']]);
}
}
return 1;
... ...