content)) { return ""; } $content = $this->content; $imgs = matchImg($this->content); foreach ($imgs as $image) { if (startWith($image, 'http')) { continue; } $full_image = url($image, '', false, $host);//加上域名 $content = str_replace($image, $full_image, $content); } return $content; } /** * 获取缩略图 * @param $host bool/string 可指定域名,默认当前域名 * @return bool|mixed|string */ public function getThumb($host = true) { if ($this->thumb) { $thumb_url = geturl($this->thumb); if (startWith($thumb_url, 'http')) { return $thumb_url; } else { return url($thumb_url, '', false, $host); } } else { //尝试从内容中提取图片 if (empty($this->content)) { return ""; } $imgs = matchImg($this->content); return count($imgs) == 0 ? "" : $imgs[0]; } } }