Heim >Backend-Entwicklung >PHP-Tutorial >explode切割foreach循环输出,加个条件 包含某字符就不输出这个组
$navinfor[down]='aaa$$$http://$$$ccc$$$ddd';$downzu = explode("$$$",$navinfor[down]); foreach($downzu as $k=>$v){ $downno=$k+1; echo $downno.'=';echo $v.'<br>';}
$navinfor['down']='aaa$$$http://$$$ccc$$$ddd';$downzu = explode("$$$",$navinfor['down']);$downno = 0; foreach($downzu as $k=>$v){ if(strpos($v, 'http') !== false) continue; $downno++; echo $downno.'='; echo $v.'<br>';}1=aaa