在你需要调用的地方输入以下代码即可:

<?php
$newstext = stripcslashes($navinfor['newstext']);
preg_match_all('/<img.*?src="(.*?)".*?>/is', $newstext, $ImgArr);
$ImgArr = array_unique($ImgArr[1]);
echo $ImgArr[0];
?>

输出样式为:

/d/file/p/2024/06-20/1718871669522719.jpg

亲测可用。

帝国cms调用文章正文内容第一张图片的方法


www.tstingmi.com 提供内容。

本文为原创文章,如需转载,必须在文章中注明原文链接;否则必究法律责任。