最初的代码如下:
$idIter=new ArrayIterator(array('01','02'));
$nameIter=new ArrayIterator(array('张三','李四'));
$mit=new MultipleIterator(MultipleIterator::MIT_KEYS_ASSOC);
$mit->attachIterator($idIter,'id');
$mit->attachIterator($nameIter,'name');
foreach($mit as $key=>$val)
{
print_r($val);
}
以上代码会报warning错误
但是,但我把$key删除过后,就没问题了~
$idIter=new ArrayIterator(array('01','02'));
$nameIter=new ArrayIterator(array('张三','李四'));
$mit=new MultipleIterator(MultipleIterator::MIT_KEYS_ASSOC);
$mit->attachIterator($idIter,'id');
$mit->attachIterator($nameIter,'name');
foreach($mit as $val)
{
print_r($val);
}