Hide specific class fields from print_r or var_dump

前端 未结 6 1582
无人及你
无人及你 2021-01-02 01:22

Is it possible to hide a specific class fields from print_r ?



        
6条回答
  •  隐瞒了意图╮
    2021-01-02 01:35

    Both print_r() and var_dump() will give you everything.

    Various Reflection classes have a getDocComment() method to get the /** doc comment */ for classes, methods and properties.

    Utilising doc comments to denote what should and should not be output, you can quite easily create a dumping class to achieve what you want.

提交回复
热议问题