• get_class_methods--返回由类的方法名组成的数组


    get_class_methods--返回由类的方法名组成的数组

    array get_class_methods ( mixed $class_name )

    返回由类的方法名组成的数组。

    <?php 
    class Person{
        public $username;
        public $age;
        public $height;
        public $weight;
        static public $number = 0;
        
        public function __construct($username,$age,$height,$weight){
            $this->username = $username;
            $this->age = $age;
            $this->height = $height;
            $this->weight = $weight;
            self::$number++;
        }
        public function __set($name,$value){
            $this->$name = $value;
        }
        
        public function __get($name){
            return $this->$name;
        }
        /**
         * 1)static方法中不能直接使用非静态成员,因为非静态成员与实例相关,通过实例化间接使用
         * 2)static方法中不能用this(与实例相关)
         * 3)非static方法中可以使用static成员
         
    */
        static public function getUsernumber(){
            var_dump(get_called_class());
            return self::$number;
        }
        
        public function getUsername(){
            var_dump(get_called_class());
            return $this->username;
        }
        
        public function __toString(){
            return '';
        }
    }
    var_dump(get_class_methods('Person'));

    ?> 

  • 相关阅读:
    MSClass (Class Of Marquee Scroll通用不间断滚动JS封装类)
    IE和FF下javascript获取网页宽高及窗口大小
    JSON View – JSON格式化查看工具
    查询功能所属的菜单
    会计科目API CCID
    应付的帐龄分析SQL
    采购到入库所经历的表
    金额大小写转换(2)
    oracle行列转换总结
    金额大小写转换(1)
  • 原文地址:https://www.cnblogs.com/zhouguowei/p/5180295.html
Copyright © 2020-2023  润新知