修改完可以添加emoji表情之后,当我们在一开始使用了emoji表情的时候,首页的文章首图会展示为emoji表情,他实际上是一个远程的图片~~
如图
修改
找到你当前的模板的module.php文件,打开,搜索GetThumFromContent,找到下面的代码:
<?php
function GetThumFromContent($content){
/*图片和摘要*/
preg_match_all("|<img[^>]+src=\"([^>\"]+)\"?[^>]*>|is", $content, $img);
if($imgsrc = !empty($img[1])){
$imgsrc = $img[1][0];}else{
preg_match_all("|<img[^>]+src=\"([^>\"]+)\"?[^>]*>|is", $content ,$img);
if($imgsrc = !empty($img[1])){ $imgsrc = $img[1][0]; }else{
$imgsrc =getrandomim();
}
}
return $imgsrc;
}
?>
将其中的匹配的代码修改为匹配本地的地址就好,这样解决了远程图片的问题,但是,如果你使用了远程图片的话,首页的首图展示就会失效,这个问题等后面再进行解决好了~~
将上面的preg_match_all("|<img[^>]+src=\"([^>\"]+)\"?[^>]*>|is", $content, $img);修改为:preg_match_all("|<img[^>]+src=\"../([^>\"]+)\"?[^>]*>|is", $content, $img);
图片展示正常

