• 首页
  • vue
  • TypeScript
  • JavaScript
  • scss
  • css3
  • html5
  • php
  • MySQL
  • redis
  • jQuery
  • ReflectionClass::getModifiers()

    (PHP 5, PHP 7)

    获取类的修饰符

    说明

    publicReflectionClass::getModifiers(void): int

    返回这个类访问修饰符的位字段。

    参数

    此函数没有参数。

    返回值

    返回修饰符常量的位掩码。

    参见

    • ReflectionClass::getProperties() 获取一组属性
    • Reflection::getModifierNames() 获取修饰符的名称
    It's the amount of memory allocation in bit.
    By default many systems allocate 1048576 bit (1 Megabit).
    /* Example 1 */
     
    class Test {}
    $classTest = new Test();
    $reflectionClass = new \ReflectionClass('Test');
    $classModifiers = $reflectionClass->getModifiers();
    var_export($classModifiers);
    //output
    1048576
    /* Example 2 */
     
    class Test {}
    //the constructor is missing
    $reflectionClass = new \ReflectionClass('Test');
    $classModifiers = $reflectionClass->getModifiers();
    var_export($classModifiers);
    //output
    0