正在显示
1 个修改的文件
包含
17 行增加
和
15 行删除
| @@ -123,21 +123,9 @@ class LoginController extends BaseController | @@ -123,21 +123,9 @@ class LoginController extends BaseController | ||
| 123 | $templateModel = new TemplateModule(); | 123 | $templateModel = new TemplateModule(); |
| 124 | $list = $templateModel->list(); | 124 | $list = $templateModel->list(); |
| 125 | foreach ($list as $k => $v){ | 125 | foreach ($list as $k => $v){ |
| 126 | - // 使用正则表达式和 preg_match_all 函数来匹配多个 img 标签的 src 值 | ||
| 127 | - preg_match_all('/\"https:\/\/develop.globalso.com\/a\/image\/(.*?)\"/', $v['html'], $matches); | ||
| 128 | - if (!empty($matches[1])) { | ||
| 129 | - $srcValues = $matches[1]; | ||
| 130 | - $imageModel = new Image(); | ||
| 131 | - $html = $v['html']; | ||
| 132 | - foreach ($srcValues as $srcValue) { | ||
| 133 | - $image_info = $imageModel->read(['hash'=>$srcValue]); | ||
| 134 | - if($image_info !== false){ | ||
| 135 | - $path = basename($image_info['path']); | ||
| 136 | - $html = $this->re($html,$srcValue,$path); | ||
| 137 | - } | ||
| 138 | - } | ||
| 139 | - $templateModel->edit(['html'=>$html],['id'=>$v['id']]); | ||
| 140 | - } | 126 | + $html = $this->re($v['html'],'https://develop.globalso.com/a/image/','https://ecdn6.globalso.com/public/template/'); |
| 127 | + $html = $this->re($v['html'],'https://develop.globalso.com/b/image/','https://ecdn6.globalso.com/public/template/'); | ||
| 128 | + $templateModel->edit(['html'=>$html],['id'=>$v['id']]); | ||
| 141 | } | 129 | } |
| 142 | return 1; | 130 | return 1; |
| 143 | } | 131 | } |
| @@ -150,4 +138,18 @@ class LoginController extends BaseController | @@ -150,4 +138,18 @@ class LoginController extends BaseController | ||
| 150 | ); | 138 | ); |
| 151 | return $html; | 139 | return $html; |
| 152 | } | 140 | } |
| 141 | + | ||
| 142 | + /* // 使用正则表达式和 preg_match_all 函数来匹配多个 img 标签的 src 值 | ||
| 143 | + preg_match_all('/\"https:\/\/develop.globalso.com\/a\/image\/(.*?)\"/', $v['html'], $matches); | ||
| 144 | + if (!empty($matches[1])) { | ||
| 145 | + $srcValues = $matches[1]; | ||
| 146 | + $imageModel = new Image(); | ||
| 147 | + $html = $v['html']; | ||
| 148 | + foreach ($srcValues as $srcValue) { | ||
| 149 | + $image_info = $imageModel->read(['hash'=>$srcValue]); | ||
| 150 | + if($image_info !== false){ | ||
| 151 | + $path = basename($image_info['path']); | ||
| 152 | + $html = $this->re($html,$srcValue,$path); | ||
| 153 | + } | ||
| 154 | + }*/ | ||
| 153 | } | 155 | } |
-
请 注册 或 登录 后发表评论