多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
```php function getImageAttr($image) { //判断图片路径是否完整 if (stripos($image, 'http') === 0 || $image === '' || stripos($image, 'data:image') === 0) { $image = $image; } else { //获取配置的上传域名 $upload = \think\Config::get('upload'); if (!empty($upload['cdnurl'])) { $image = $upload['cdnurl'] . $image; } else { //自动获取域名并拼接 $http_type = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://'; $image = $http_type . $_SERVER['HTTP_HOST'] . $image; } } return $image; } ```