php中this关键字用法分析

ghjkgkj 10 0 PDF 2021-01-01 02:01:06

本文实例讲述了php中this关键字用法。分享给大家供大家参考,具体如下: 下面定义了一个Cart类 <?php class Cart { var $items; // 购物车中的项目 // 把 $num 个 $artnr 放入车中 function add_item ($artnr, $num) { $this->items[$artnr] += $num; } // 把 $num 个 $artnr 从车中取出 function remove_item ($artnr, $num) { if ($this->items[$artnr]

用户评论
请输入评论内容
评分:
暂无评论