正在显示
1 个修改的文件
包含
11 行增加
和
8 行删除
| @@ -127,24 +127,27 @@ class LoginController extends BaseController | @@ -127,24 +127,27 @@ class LoginController extends BaseController | ||
| 127 | preg_match_all('/\"https:\/\/develop.globalso.com\/a\/image\/(.*?)\"/', $v['html'], $matches); | 127 | preg_match_all('/\"https:\/\/develop.globalso.com\/a\/image\/(.*?)\"/', $v['html'], $matches); |
| 128 | if (!empty($matches[1])) { | 128 | if (!empty($matches[1])) { |
| 129 | $srcValues = $matches[1]; | 129 | $srcValues = $matches[1]; |
| 130 | - var_dump($srcValues); | ||
| 131 | - die(); | ||
| 132 | $imageModel = new Image(); | 130 | $imageModel = new Image(); |
| 133 | $html = $v['html']; | 131 | $html = $v['html']; |
| 134 | foreach ($srcValues as $srcValue) { | 132 | foreach ($srcValues as $srcValue) { |
| 135 | $image_info = $imageModel->read(['hash'=>$srcValue]); | 133 | $image_info = $imageModel->read(['hash'=>$srcValue]); |
| 136 | if($image_info !== false){ | 134 | if($image_info !== false){ |
| 137 | $path = basename($image_info['path']); | 135 | $path = basename($image_info['path']); |
| 138 | - $html = str_replace( | ||
| 139 | - $srcValue, | ||
| 140 | - $path, | ||
| 141 | - $html | ||
| 142 | - ); | 136 | + $html = $this->re($html,$srcValue,$path); |
| 143 | } | 137 | } |
| 144 | } | 138 | } |
| 145 | - $templateModel->edit(['html'=>$v['html']],['id'=>$v['id']]); | 139 | + $templateModel->edit(['html'=>$html],['id'=>$v['id']]); |
| 146 | } | 140 | } |
| 147 | } | 141 | } |
| 148 | return 1; | 142 | return 1; |
| 149 | } | 143 | } |
| 144 | + | ||
| 145 | + public function re(&$html,$srcValue,$path){ | ||
| 146 | + $html = str_replace( | ||
| 147 | + $srcValue, | ||
| 148 | + $path, | ||
| 149 | + $html | ||
| 150 | + ); | ||
| 151 | + return $html; | ||
| 152 | + } | ||
| 150 | } | 153 | } |
-
请 注册 或 登录 后发表评论