Getting static property from a class with dynamic class name in PHP

后端 未结 11 506
情歌与酒
情歌与酒 2020-11-30 01:44

I have this:

  • one string variable which holds the class name ($classname)
  • one string variable with holds the property name ($propert
11条回答
  •  爱一瞬间的悲伤
    2020-11-30 02:10

    One thing I noticed is that you can't set variables which are protected in static classes as the eval() command runs in a scope outside the class. The only thing to get around this would be to implement a static method inside the/every class which runs the eval(). This method could be protected as the call_user_func() [to call the setter method] also runs from inside the class.

提交回复
热议问题