class Basket
{
.............................
.............................
function Enum_Items($start=false)
{
static $current;// 声明一个静态变量,用于存放当前数量
if ($current>=$this->basket_count)// 如果当前数量大于规定的总数,返回错误
return -1;
if (!$start)// 如果开始累加,那就累加
{
$current++;
}
else
{
$current=0;// 否则置为0
}
// 如果当前没有东西并且数量比规定的总数小,则累加当前值.
while (($this->basket_item_id[$current]=='') && ($current<$this->basket_count))
{
$current++;
} // 如果当前数量仍比总数少,则视为合法,返回此数据,否则返回错误信息
return ($current<$this->basket_count) ? $current : -1;
}
}
{
.............................
.............................
function Enum_Items($start=false)
{
static $current;// 声明一个静态变量,用于存放当前数量
if ($current>=$this->basket_count)// 如果当前数量大于规定的总数,返回错误
return -1;
if (!$start)// 如果开始累加,那就累加
{
$current++;
}
else
{
$current=0;// 否则置为0
}
// 如果当前没有东西并且数量比规定的总数小,则累加当前值.
while (($this->basket_item_id[$current]=='') && ($current<$this->basket_count))
{
$current++;
} // 如果当前数量仍比总数少,则视为合法,返回此数据,否则返回错误信息
return ($current<$this->basket_count) ? $current : -1;
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货