锟斤拷锟斤拷

锟斤拷谋锟斤拷锟斤拷锟皆憋拷锟斤拷锟�"锟斤拷锟斤拷"锟斤拷锟斤拷锟竭斤拷"锟街讹拷"锟斤拷"锟斤拷锟斤拷"锟斤拷锟节憋拷锟侥碉拷统一锟斤拷为"锟斤拷锟斤拷"锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟缴关硷拷锟斤拷 public锟斤拷protected 锟斤拷锟斤拷 private 锟斤拷头锟斤拷然锟斤拷锟揭伙拷锟斤拷锟酵拷谋锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟缴★拷锟斤拷锟斤拷锟叫的憋拷锟斤拷锟斤拷锟皆筹拷始锟斤拷锟斤拷锟斤拷锟角筹拷始锟斤拷锟斤拷值锟斤拷锟斤拷锟角筹拷锟斤拷锟斤拷锟斤拷锟斤拷某锟斤拷锟斤拷锟街� PHP 锟脚憋拷锟节憋拷锟斤拷锥锟绞憋拷涂锟斤拷缘玫锟斤拷锟街碉拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟绞憋拷锟斤拷锟较拷锟斤拷锟斤拷锟街碉拷锟�

锟叫癸拷 public锟斤拷protected 锟斤拷 private 锟侥革拷锟斤拷锟斤拷细锟斤拷息锟斤拷锟斤拷榭�锟斤拷锟绞匡拷锟狡o拷锟缴硷拷锟皆o拷锟斤拷

Note:

为锟斤拷锟斤拷锟斤拷锟斤拷 PHP 4锟斤拷PHP 5 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷然锟斤拷锟斤拷直锟斤拷使锟矫关硷拷锟斤拷 var 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷吒锟斤拷锟斤拷冢锟�public锟斤拷protected 锟斤拷 private锟斤拷锟斤拷锟斤拷锟窖诧拷锟斤拷锟斤拷要 var 锟剿★拷锟斤拷 PHP 5.0 锟斤拷 5.1.3锟斤拷var 锟结被锟斤拷为锟角凤拷锟斤拷锟侥o拷锟斤拷锟斤拷锟阶筹拷 E_STRICT 锟斤拷锟芥,锟斤拷锟斤拷 5.1.3 之锟斤拷筒锟斤拷锟斤拷锟轿拷欠锟斤拷锟斤拷锟揭诧拷锟斤拷锟斤拷壮锟斤拷锟斤拷妗�

锟斤拷锟街憋拷锟绞癸拷锟� var 锟斤拷锟斤拷锟斤拷锟皆o拷锟斤拷没锟斤拷锟斤拷 public锟斤拷protected 锟斤拷 private 之一锟斤拷PHP 5 锟结将锟斤拷锟斤拷为 public锟斤拷

锟斤拷锟斤拷某锟皆憋拷锟斤拷锟斤拷锟斤拷妫拷锟斤拷锟斤拷锟� ->锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟�$this->property锟斤拷锟斤拷锟斤拷 property 锟角革拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟街凤拷式锟斤拷锟斤拷锟绞非撅拷态锟斤拷锟皆★拷锟斤拷态锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 ::锟斤拷双冒锟脚o拷锟斤拷self::$property 锟斤拷锟斤拷锟绞★拷锟斤拷锟洁静态锟斤拷锟斤拷锟斤拷蔷锟教拷锟斤拷缘锟斤拷锟斤拷锟轿硷拷 Static 锟截硷拷锟斤拷锟斤拷

锟斤拷一锟斤拷锟斤拷锟斤拷锟斤拷锟洁定锟斤拷锟节诧拷锟斤拷锟斤拷锟斤拷时锟斤拷锟斤拷一锟斤拷锟斤拷锟矫碉拷伪锟斤拷锟斤拷 $this锟斤拷$this 锟斤拷一锟斤拷锟斤拷锟斤拷锟叫讹拷锟斤拷锟斤拷锟斤拷茫锟酵拷锟斤拷歉梅锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷亩锟斤拷螅锟斤拷锟斤拷锟角从第讹拷锟斤拷锟斤拷锟斤拷锟斤拷态锟斤拷锟斤拷时也锟斤拷锟斤拷锟斤拷锟斤拷一锟斤拷锟斤拷锟襟)★拷

Example #1 锟斤拷锟斤拷锟斤拷锟斤拷

<?php
class SimpleClass
{
   
// 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟�
   
public $var1 'hello ' 'world';
   public 
$var2 = <<<EOD
hello world
EOD;
   public 
$var3 1+2;
   public 
$var4 self::myStaticMethod();
   public 
$var5 $myVar;

   
// 锟斤拷确锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
   
public $var6 myConstant;
   public 
$var7 = array(truefalse);

   
//锟斤拷 PHP 5.3.0 锟斤拷之锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟揭诧拷锟饺�
   
public $var8 = <<<'EOD'
hello world
EOD;
}
?>

Note:

锟斤拷锟斤拷锟斤拷锟斤拷啵拷锟斤拷锟侥达拷锟斤拷锟斤拷锟斤拷锟斤拷榭�锟洁/锟斤拷锟斤拷锟斤拷锟斤拷

锟斤拷 heredocs 锟斤拷同锟斤拷nowdocs 锟斤拷锟斤拷锟轿何撅拷态锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷使锟矫o拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷

Example #2 示锟斤拷锟斤拷使锟斤拷 nowdoc 锟斤拷始锟斤拷锟斤拷锟斤拷

<?php
class foo {
   
// 锟斤拷 5.3.0 锟斤拷
   
public $bar = <<<'EOT'
bar
EOT;
}
?>

Note:

Nowdoc 支锟斤拷锟斤拷锟斤拷 PHP 5.3.0 锟斤拷锟斤拷锟侥★拷