<?php
class aa{
static public $zz = 8;
public function a1(){
$a=1;
$this->a2();
return $a;
}
public function a2(){
$this->zz +=1;
}
}
$k = new aa();
$k->a1();
$k->a2();
echo $k->zz;
echo '<br>';
echo $k->a1();
die();
Strict Standards: Accessing static property aa::$zz as non static in D:WWWclient.php on line 13
Notice: Undefined property: aa::$zz in D:WWWclient.php on line 13
Strict Standards: Accessing static property aa::$zz as non static in D:WWWclient.php on line 27
2
Strict Standards: Accessing static property bb::$zz as non static in D:WWWclient.php on line 13
Notice: Undefined property: bb::$zz in D:WWWclient.php on line 13
1
phpcn_u15822017-05-16 13:15:40
静的メンバー変数には静的メソッドのみがアクセスでき、静的メソッドは静的メンバーのみにアクセスできます
静的メンバーにアクセスする方法:
リーリー