大家看看这个类里的方法函数是什么意思啊

mhzzz 2004-10-11 01:28:19
<?
class Basket
{
.............................
.............................
function Enum_Items($start=false)
{
static $current;
if ($current>=$this->basket_count)
return -1;
if (!$start)
{
$current++;
}
else
{
$current=0;
}
while (($this->basket_item_id[$current]=='') && ($current<$this->basket_count))
{
$current++;
}
return ($current<$this->basket_count) ? $current : -1;
}
}
?>
...全文
73 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
mhzzz 2004-10-11
  • 打赏
  • 举报
回复
谢谢啊
死胖子 2004-10-11
  • 打赏
  • 举报
回复
ustb(偶然) ( 兄已经解释很清楚了,,看来我是来晚了,,UP接分吧。。
ustb 2004-10-11
  • 打赏
  • 举报
回复
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;
}
}

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧