Get string within protected object

后端 未结 4 1005
庸人自扰
庸人自扰 2020-12-21 05:45

I am trying to get the the string \"this info\" inside this object lets call it $object, but data is protected, how can I access that pocket?

           


        
4条回答
  •  渐次进展
    2020-12-21 06:15

    You can use the famous getters and setters methods to private/protected properties. Ex:

    helloMessage;
        }
    
        public function setHelloMessage( $value )
        {
            //Validations
            $this->helloMessage = $value;
        }
    }
    
    ?>
    

    Greetings,

    Estefano.

提交回复
热议问题