请求讲解一下continue的用法:while($row = $dsql->GetArray()) { $tb = str_replace('#@__',$cfg_dbprefix,$row['addtable']); if(empty($tb) || isset($doarray[$tb]) ) { continue;?} else { $sql = "INSERT INTO `#@__arctiny`(id,typeid,typeid2,arcrank

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/16 17:31:56

请求讲解一下continue的用法:while($row = $dsql->GetArray()) { $tb = str_replace('#@__',$cfg_dbprefix,$row['addtable']); if(empty($tb) || isset($doarray[$tb]) ) { continue;?} else { $sql = "INSERT INTO `#@__arctiny`(id,typeid,typeid2,arcrank
请求讲解一下continue的用法:
while($row = $dsql->GetArray()) {
$tb = str_replace('#@__',$cfg_dbprefix,$row['addtable']);
if(empty($tb) || isset($doarray[$tb]) )
{
continue;?
} else {
$sql = "INSERT INTO `#@__arctiny`(id,typeid,typeid2,arcrank,channel,senddate,
sortrank,mid) SELECT aid,typeid,0,arcrank,channel,senddate,0,mid FROM `$tb` ";
$rs = $dsql->executenonequery($sql);
$doarray[$tb] = 1;
}
}
请问这里的continue;是什么意思?在这段代码中如果不写它,效果与写上它有何不同?

请求讲解一下continue的用法:while($row = $dsql->GetArray()) { $tb = str_replace('#@__',$cfg_dbprefix,$row['addtable']); if(empty($tb) || isset($doarray[$tb]) ) { continue;?} else { $sql = "INSERT INTO `#@__arctiny`(id,typeid,typeid2,arcrank
continue的意思是跳过本次循环进行下一次,还有break表示结束当前循环,例如
for ($i = 0; $i = 6) break;//如果$i大于等于6,结束循环
}
输出结果 0246
在你的示例中,这个continue可以不写,因为后面本来也没有需要执行的代码了.实际上你的示例代码应该写为
if(!empty($tb) && !isset($doarray[$tb]) ) {
$sql = .;
}
一个单if就行了,根本不需要if else