php.net

Class member variables are called "properties".
You may also see them referred to using other terms such as "attributes" or "fields",
but for the purposes of this reference we will use "properties".
类的变量成员叫做"属性",或者叫"字段"、"特征",在本文档统一称为"属性"。
 They are defined by using one of the keywords public, protected, or private, followed by a normal variable declaration.
 This declaration may include an initialization, but this initialization must be a constant value--that is,
 it must be able to be evaluated at compile time and must not depend on run-time information in order to be evaluated.
属性声明是由关键字 public,protected 或者 private 开头,然后跟一个普通的变量声明来组成。
属性中的变量可以初始化,但是初始化的值必须是常数,这里的常数是指 PHP 脚本在编译阶段(E compile time)时就可以得到其值,而不依赖于运行(E run-time)时的信息才能求值。

Within class methods non-static properties may be accessed by using -> (Object Operator): $this->property
(where property is the name of the property).

Static properties are accessed by using the :: (Double Colon): self::$property.

The pseudo-variable $this is available inside any class method  when that method is called from within an object context.

$this is a reference to the calling object (usually the object to which the method belongs, but possibly another object,

if the method is called statically from the context of a secondary object).
当一个方法在类定义内部被调用时,有一个可用的伪变量 $this。

$this 是一个到主叫对象的引用(通常是该方法所从属的对象,但如果是从第二个对象静态调用时也可能是另一个对象)。

It is possible to define constant values on a per-class basis remaining the same and unchangeable.

Constants differ from normal variables in that you don't use the $ symbol to declare or use them.

The default visibility of class constants is public.

The value must be a constant expression, not (for example) a variable, a property, or a function call.

可以把在类中始终保持不变的值定义为常量。在定义和使用常量的时候不需要使用 $ 符号。
常量的值必须是一个定值,不能是变量,类属性,数学运算的结果或函数调用。

compile time - run-time的更多相关文章

  1. BPF的可移植性和CO-RE (Compile Once – Run Everywhere)

    BPF的可移植性和CO-RE (Compile Once – Run Everywhere) 在上一篇文章中介绍了提高socket性能的几个socket选项,其中给出了几个源于内核源码树中的例子,如果 ...

  2. 模拟IDE上的run过程

    看了一下老陈写的模仿JDK动态代理,从中取一部分单独扩展,模拟一下IDE上的run过程(不愧是老陈,去年写的东西我要现在才能理解) 对run过程的猜想 在点击run的过程中应该做了不少事.先编译运行r ...

  3. Write Once, Run Anywhere:这不是Java,这是C#

    注意,本文目的并非挑起语言之争.虽然有为C#平反之意,但主要还是介绍Mono并进行简单的测试. UPDATED: 25th August 2012 更新了「Compile Once, Run Anyw ...

  4. DotNet 资源大全中文版(Awesome最新版)

    Awesome系列的.Net资源整理.awesome-dotnet是由quozd发起和维护.内容包括:编译器.压缩.应用框架.应用模板.加密.数据库.反编译.IDE.日志.风格指南等. 算法与数据结构 ...

  5. Learning the standard of C++11

    It's a very useful website of en.cppreference.com. It lists a huge number of information about the l ...

  6. xv6的作业翻译——作业1 - shell和系统调用

    Xv6的lecture LEC 1 Operating systems   L1: O/S overview L1:O/S概述   * 6.828 goals 6.828的目标   Understan ...

  7. Swift 3 and OpenGL on Linux and macOS with GLFW

    https://solarianprogrammer.com/2016/11/19/swift-opengl-linux-macos-glfw/ Swift 3 and OpenGL on Linux ...

  8. Use Qt in Debian for OpenCASCADE

    Use Qt in Debian for OpenCASCADE eryar@163.com Recently several OpenCASCADE enthusiasts want to buil ...

  9. Spring Boot文档阅读

    原因之初 最初习惯百度各种博客教程,然后跟着操作,因为觉得跟着别人走过的路走可以少走很多弯路,省时间.然而,很多博客的内容并不够完整,甚至错误,看多了的博客甚至有千篇一律的感觉.此外,博客毕竟是记载博 ...

  10. Ant_build.xml的最完整解释

    Ant的概念Make命令是一个项目管理工具,而Ant所实现功能与此类似.像make,gnumake和nmake这些编译工具都有一定的缺陷,但是Ant却克服了这些工具的缺陷.最初Ant开发者在开发跨平台 ...

随机推荐

  1. 有人在群里问关于SQL表组合数据问题

    他的问题如下 如此我建表如下: 如果想根据用户进行分组后 又要显示所属门店在同一个字段中的话,这里需要用group_concat来显示 同时关联的时候可用find_in_set来处理 我设计的SQL如 ...

  2. PHP代码审计笔记--任意文件下载漏洞

    在文件下载操作中,文件名及路径由客户端传入的参数控制,并且未进行有效的过滤,导致用户可恶意下载任意文件.  0x01 客户端下载 常见于系统中存在文件(附件/文档等资源)下载的地方. 漏洞示例代码: ...

  3. hudson.AbortException: No files found in path D:\testproject\project2\testoutput\ with configured filemask: output.xml

    错误描述: hudson.AbortException: No files found in path D:\testproject\project2\testoutput\ with configu ...

  4. vi 中大小写转换功能

    所有的操作都是围绕着“gu"和“gU”另个命令展开的.secooler的语法:[开始位置]gu/Gu[结束位置]secooler的翻译: [开始位置] ---- 可以指定开始的位置,默认是光 ...

  5. select选择option时触发的click事件google不兼容问题

    原先的方式,下面代码编写的问题在google浏览器下是触发不了click事件的,具体缘由不清楚,反正都可以概括为不兼容了 碰到问题时,百度到的一篇解决:http://blog.163.com/rihu ...

  6. PowerDesigner快捷键【转】

    一般快捷键 快捷键 说明 F4 打开检查模型窗口,检查模型 F5 如果图窗口内的图改变过大小,恢复为原有大小即正常大小 F6 放大图窗口内的图 F7 缩小图窗口内的图 F8 在图窗口内中查看全部图内容 ...

  7. 【PHP】 curl 上传文件 流

    在运行过程中, 以下两种方式要看你的PHP 版本 'file' =>'@' .$filePath 'file' =>new CURLFile(realpath($filePath)) 本次 ...

  8. Delphi应用程序的调试(三)监视变量

    监视变量(Watching Variables) 当程序停在一个断点处时,用户做些什么呢?通常用户在断点处停下来是要检查变量的值,某个变量的值是否与预料的取值相同?或者某个变量取什么值(事先并不知道这 ...

  9. 【JavaScript】如何判断一个对象是未定义的?(已解决)

    JavaScript中,如果使用了一个未定义的变量,会有这样的错误提示:XXX未定义. 代码中,怎样才能判定一个对象是否定义了呢? 使用  typeof 示例: if("undefined& ...

  10. WPS 2019 去除自动升级 和 广告、及优化的点

    搜狗输入法 里面的快捷键会影响wps的快捷键功能,需要关掉"搜狗输入法"里面的快捷键 1. 2.去除自动升级功能 3.去除 广告 WPS 2019 流程图(断网): 思维导图: 流 ...