PHP Magic Method __get __set (ii), __get__set
Slowly long search night, the moon hanging
__get ()-__get () is called when the value of the Inaccessible property is read
__set ()-__set () is called when a value is assigned to an unreachable property
"Echo $example->public." \ n "; Echo $example->protected." \ n "; Echo $example->private." \ n "; Echo $example->other." \ n "; echo"; $example->public = ' lic ' ; This assignment succeeds all does not show $example->protected = ' tec '; $example->private = ' VAT '; $example->other = ' er '; Echo '
The results are as follows:
Pub calls the __get () method: protected Call the __get () method: Private Call the __get () method: Othername: protected, Value:tecname:private, value:vatname:other, value: Public Property: Lic
http://www.bkjia.com/PHPjc/916823.html www.bkjia.com true http://www.bkjia.com/PHPjc/916823.html techarticle PHP Magic Method __get __set (ii), __get__set slowly long seek night, the moon Hanging __get ()-Read the value of the Inaccessible property, __get () will be called __set ()-in the given inaccessible properties ...