Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
什么时候初始化静态属性,据我所知,其他成员属性是在创建对象时初始化的。
谢谢
将类属性或方法声明为静态使它们无需实例化即可访问。声明为静态的属性不能用实例化的类对象访问(尽管静态方法可以)。
/http://php.net/manual/en/language.oop5.static.php _
因此,它们在声明后可用。
静态属性?你的意思是静态变量还是方法?
无论哪种方式,它们都会在解析脚本或定义类时初始化。