类的常量属性和方法
1、常量
类的常量中所有字母都 必须 大写,词间以下划线分隔
2、属性
类的属性命名 可以 遵循:
大写开头的驼峰式 ($StudlyCaps)小写开头的驼峰式(
$camelCase
)建议下划线分隔式($under_score)
3、方法
方法名称 必须 符合 camelCase()
式的小写开头驼峰命名规范。
<?php
namespace Vendor\Model;
class Foo
{
const VERSION = '1.0';
const DATE_APPROVED = '2012-06-01';
static $userName;
private $userName;
protect $userName;
public static function getUserInfo()
{
}
}
Last updated
Was this helpful?