In smarty3, the template directory $ template_dir and the compilation directory $ compile_dir are all modified with protected. Why can we directly access the woman outside the class ?? I changed protected in the source code to private and can still access it. why? ------ Solution -------------------- does it have such a definition? A small question about PHPcode
In smarty3, the template directory $ template_dir and the compilation directory $ compile_dir are all modified with protected. Why can I directly access the woman outside the class ??
I changed protected in the source code to private and can still access it. why?
------ Solution --------------------
Does it have such a definition?
PHP code
Public function _ get ($ name) {$ allowed = array ('Template _ dir' => 'gettemplatedir', 'config _ dir' => 'getconfigdir ', 'ins ins _ dir' => 'getininsdir', 'compile _ dir' => 'getcompiledir', 'cache _ dir' => 'getcachedir ',); if (isset ($ allowed [$ name]) {return $ this-> {$ allowed [$ name]} () ;} else {trigger_error ('undefined property :'. get_class ($ this ). ': $ '. $ name, E_USER_NOTICE );}}