魔术方法(magic methods)

  • __constract(), __destrcut(), __clone()
  • __get(), __set() -> 类的未定义的变量get与set
  • __isset(), __unset() -> isset,empty unset
  • __call(), __callStatic() -> 调用未定义的方法与静态方法时
  • __toString() -> echo
  • __invoke -> 当把一个对象当作函数调用的时候 如 $a = new A; $a(‘a’);

魔术常量(magic constants)

  • __LINE__
  • __FILE__
  • __DIR__
  • __CLASS__
  • __FUNCTION__
  • __METHOD__
  • __TRAIT__
  • __NAMESPACE__