作者 lyh

gx

... ... @@ -127,24 +127,27 @@ class LoginController extends BaseController
preg_match_all('/\"https:\/\/develop.globalso.com\/a\/image\/(.*?)\"/', $v['html'], $matches);
if (!empty($matches[1])) {
$srcValues = $matches[1];
var_dump($srcValues);
die();
$imageModel = new Image();
$html = $v['html'];
foreach ($srcValues as $srcValue) {
$image_info = $imageModel->read(['hash'=>$srcValue]);
if($image_info !== false){
$path = basename($image_info['path']);
$html = str_replace(
$srcValue,
$path,
$html
);
$html = $this->re($html,$srcValue,$path);
}
}
$templateModel->edit(['html'=>$v['html']],['id'=>$v['id']]);
$templateModel->edit(['html'=>$html],['id'=>$v['id']]);
}
}
return 1;
}
public function re(&$html,$srcValue,$path){
$html = str_replace(
$srcValue,
$path,
$html
);
return $html;
}
}
... ...