1
如何在类中从类中遍历所有公共变量?遍历所有公共变量并将NULL值转换为空字符串
如何获取公共变量?
private function translate_null_values_to_strings(){
foreach($this->public_vars as $key => $value){
if(is_null($this->$key)) $this->$key = '';
}
}
http://stackoverflow.com/questions/3309320/php-get-classes - 公共变量 – vaso123
['ReflectionClass :: getProperties'](http://php.net/manual/en/reflectionclass.getproperties.php)'(ReflectionProperty :: IS_PUBLIC)' –
我会避免这样做..有东西错误在您的应用程序中,如果对象有一些属性设置为您不想以后的值.. –