No details? Php private variable writing and reading classMyinfo {private $ Name; private $ Age; private $ Job; function _ call ($ funcName, $ arArguments) {$ opsTypesubstr ($ funcName, 0, 3); $ opsKeysubstr ($ funcName, 3); switch ($ opsType) {caseset: return ($ this-SetAcc
No details? Php // write and read private variables class Myinfo {private $ Name; private $ Age; private $ Job; function _ call ($ funcName, $ arArguments) {$ opsType = substr ($ funcName, 0, 3); $ opsKey = substr ($ funcName, 3); switch ($ opsType) {case 'set': return ($ this-SetAcc
<无详细内容> <无>
SetAccessor ($ opsKey, $ arArguments [0]); break; case 'get': return ($ this-> GetAccessor ($ opsKey); break ;} return (false);} private function SetAccessor ($ opsKey, $ value) {if (property_exists ($ this, $ opsKey) {if (is_numeric ($ value )) {eval ('$ this-> '. $ opsKey. '= '. $ value. ';');} else {eval ('$ this-> '. $ opsKey. '= "'. $ value. '";') ;}} else {return (false) ;}} private function GetAccessor ($ opsKey) {if (property_exists ($ this, $ opsKey )) {eval ('$ name = $ this-> '. $ opsKey. ';'); return ($ name) ;}else {return (false) ;}} function _ toString () {return "Name: $ this-> Name
Age: $ this-> Age
Job: $ this-> Job
";}}$ Wzy = new Myinfo (); $ wzy-> setName ('wzy '); $ wzy-> setAge (22 ); $ wzy-> setJob ('student '); echo $ wzy;?>