/** * 将图片按照 | 切割,取第一张 * @param $spic * @return mixed */ function images_spic($spic){ //统计字符串中 | 有多少个 if(substr_count($spic,"|")>=1){ //将字符串切割为数组 $arr = explode("|",$spic); //取第一个 $image = $arr[0]; }else{ $image = $spic; } return $image; }