问题描述
|
我正在使用以下代码来从博客文章中获取图片:
function catch_that_image() {
global $post,$posts;
$first_img = \'\';
ob_start();
ob_end_clean();
$output = preg_match_all(\'/<img.+src=[\\\'\"]([^\\\'\"]+)[\\\'\"].*>/i\',$post->post_content,$matches);
$first_img = $matches [1] [0];
if(empty($first_img)){ //Defines a default image
$first_img = \"/images/default.jpg\";
}
return $first_img;
}
现在,我需要一些帮助来进行较小的修改。这是我要查找的内容:我希望代码忽略第一个图像,抓取它找到的第二个图像,如果找不到第二个图像,则使用默认图像(后备图像)。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)