PHP的各种拦截器
来源:互联网 发布:网络监控技术方案 编辑:程序博客网 时间:2024/05/16 08:10
个人测试及用例,主要目的用于外部访问类内部属性的特定方法。
<?phpclass getsetcall{ private $var; /** * PHP interceptor */ public function __set($key,$value) { return $this->$key = $value; } public function __get($key){ if(isset($key)){ return $this->$key; }else{ return NULL; } } public function __call($method_name,$arg_array) { echo "Your call function is $method_name"; print_r($arg_array); echo "not exist."; } public function __unset($property) { echo "Called when outer call private var<br>"; unset($this->$property); } public function __isset($property) { echo "Called when outer call private var<br>"; return isset($this->$property); }}/*#======= test __set and __get =======$obj = new getsetcall();$obj->var = "maxoi";echo $obj->var;*//*#======= test __call =======$o = new getsetcall();$o->test(2,"test");*//*#======= test __unset =======$obj = new getsetcall();$obj->var = "a";echo $obj->var;unset($obj->var);echo "Unset after.....".$obj->var;*//*#======= test __isset =======$obj = new getsetcall();$obj->var = "a";echo isset($obj->var);*/?>
0 0
- PHP的各种拦截器
- php 类中的各种拦截器
- PHP的拦截器
- PHP简单拦截器的实现
- Shiro实际使用(实现各种实用的拦截器)
- php拦截器方法
- PHP拦截器
- 基于PHP的THINKPHP3.2的AOP拦截器使用
- PHP的各种遍历
- PHP简单拦截器实现方法【参考java的AOP】
- PHP中拦截器interceptor的使用解析
- PHP中的拦截器设计
- PHP入门(6) 拦截器
- php的各种编码问题
- 各种版本的PHP下载
- php的各种比较函数
- php的各种时间查询
- Spring AOP 各种拦截方法执行的顺序
- 45、Linux初步(CentOS 7下安装Maven)
- Haar特征Adaboost级联分类器训练经验——Practical Tips
- spring源码学习--FileSystemXmlApplicationContext(二)
- 主进程与子进程的通信(handler)
- [C++][STL](一)vector和stack的学习
- PHP的各种拦截器
- Linux进程间通信——内存共享
- Java基础---I/O流操作
- Linux命令
- 如何实现axi_lite的双向传递
- C++读取文件的问题
- nachos-java Task1.1 Join
- PL/SQL中Command Window自动换行问题
- HDU1051 Wooden Sticks