得到所有类常量

时间:2010-10-15 22:54:36

标签: php class constants

  

可能重复:
  Can I get CONST's defined on a PHP class?

有没有办法在php类中获取所有常量。尝试了get_class_vars(get_called_class())

    class Status
{        
    const PUBLISHED = "published";
    const DRAFT = "draft";

    public static function get_types()
    {
        return array(self::PUBLISHED, self::DRAFT);
    }
}

由于

0 个答案:

没有答案