RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
数组形式访问对象
//数组形式访问对对象
/**
* 1.通过继承PHP内置接口ArrayAccess来实现
* 2.必须实现方法:offsetExists,offsetGet,offsetSet,offsetUnset;
*/
classNewObjectimplementsArrayAccess
{
   /**
    * 检查一个偏移位置是否存在
    *@parammixed $offset
    *@returnbool
    */
   public functionoffsetExists($offset)
   {
       //处理逻辑代码
   }


   /**
    * 获取一个偏移位置的值
    *@parammixed $offset
    *@returnnull
    */
   public functionoffsetGet($offset)
   {
       //处理逻辑代码
   }


   /**
    * 设置一个偏移位置的值
    *@parammixed $offset
    *@parammixed $value
    */
   public functionoffsetSet($offset,$value)
   {
       //处理逻辑代码
   }

   /**
    * 复位一个偏移位置的值
    *@parammixed $offset
    *@returnnull
    */
   public functionoffsetUnset($offset)
   {
       //处理逻辑代码
   }
}

当前名称:数组形式访问对象
文章分享:http://scyingshan.cn/article/gcsdjh.html