get_class()函数返回对象所属类的名字(PHP基础教程)
下面我们来看下案例:
- <?php
- class example{
- function exam(){
- if(isset($this)){
- echo '$this的值为:'. get_class($this);
- }else{
- echo '未定义。';
- }
- }
- }
- $zidiu = new example;
- $zidiu->exam();
复制代码 PHP源码运行输出结果:
get_class()函数返回对象所属类的名字(PHP基础教程)
|