作者 lyh

gx

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