你们可以宣布这种类型的财产。 某类人员可以是数据成员(客户和财产)或方法。 在PHP 5型做事方式中,这基本上是它如何运作:
// de facto best practice: class names start with uppercase letter
class Abc
{
// de facto best practice: ALL UPPERCASE letters for constants
const SOME_COSTANT = this value is immutable ; // accessible outside and inside this class like Abc::SOME_CONSTANT or inside this class like self::SOME_CONSTANT
public $a = Hello ; // a data member that is accessible to all
protected $b = Hi ; // a data membet that is accessible to this class, and classes that extend this class
private $c = Howdy ; // a data member that is accessible only to this class
// visibility keywords apply here also
public function aMethod( $with, $some, $parameters ) // a method
{
/* do something */
}
}
确实,你不应考虑使用第4号站点的做法,即用<代码>var的关键词宣布数据成员,除非你仍在为第4号站点开发数据。