Static Keyword--静态关键字

Static Keyword --静态关键字

     Declaring class members or methods as static makes them accessible without needing an instantiation of the class. A member declared as static can not be accessed with an instantiated class object (though a static method can).

     声明类里的静态类成员或者静态方法可以是这些类成员或者方法在不实例化的情况下直接被访问。一个静态类成员不能用实例化后的对象操作符(->)来访问。

 

      For compatibility with PHP 4, if no visibility declaration is used, then the member or method will be treated as if it was declared as public .

      就兼容而言,如果使用了一个没有声明的变量,那么这个成员或者方法会被当做声明为:public 了。

 

Because static methods are callable without an instance of the object created, the pseudo variable $this is not available inside the method declared as static.

    由于静态类方法可以在不需要实例化类的情况下被调用,伪变量$this 在声明为static 的方法中不可调用

Static properties cannot be accessed through the object using the arrow operator ->.Calling non-static methods statically generates an E_STRICT level warning.

     static 属性无法通过对象的箭头操作符( ->)来访问,调用non-static方法会产生一个 E_STRICT 级别的警告

As of PHP 5.3.0, it's possible to reference the class using a variable. Keywords like self , parent or static are not allowed in dynamic class references.

     作为php5.3.0 可能提及到了可以用变量来定义一个类,例如:self 、parent 或者 static 关键字是不允许作为动态类

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值