Content; //文章内容 preg_m; 相思资源网更新日期:2025/11/3">
(编辑:jimmy 日期: 2025/11/3 浏览:2)
<"/<[img|IMG].*"](.*"].*";
$content = $article->Content; //文章内容
preg_match_all($pattern,$content,$matchContent);
if(isset($matchContent[1][0])){
$temp=$matchContent[1][0];
}else{
$temp="images/random/$temp.jpg";//需要在相应位置放置4张jpg的文件,名称为1,2,3,4
}
"htmlcode">
<"/<[img|IMG].*"](.*"].*";
$content = $article->Content; //文章内容
preg_match_all($pattern,$content,$matchContent);
if(isset($matchContent[1][0])){
$temp=$matchContent[1][0];
}else{
$temp="./images/no-image.jpg";//在相应位置放置一张命名为no-image的jpg图片
}
?>
调用文章首张图片,如果文章没有图片就调用默认图片no-image.jpg