$content = $info['content']; $preg="/src=['"]?(.*?)['"]/" ; preg_match_all($preg, $content, $matches); $imgArr = array_unique($matches);//去除重复的值 echo count($imgArr[0]);//计数