PHP equivalent for a python decorator?

前端 未结 5 628
夕颜
夕颜 2020-12-29 09:04

I want to be able to wrap a PHP function by another function, but leaving its original name/parameter list intact.

For instance:

function A() {
    p         


        
5条回答
  •  一向
    一向 (楼主)
    2020-12-29 09:53

    Apparently runkit might help you.

    Also, you can always do this the OO way. Put the original fun in a class, and the decorator into an extended class. Instantiate and go.

提交回复
热议问题