How to add a method to an existing class in PHP?

后端 未结 5 1270
情深已故
情深已故 2020-12-05 04:58

I\'m using WordPress as a CMS, and I want to extend one of its classes without having to inherit from another class; i.e. I simply want to \"add\" more methods to that class

5条回答
  •  温柔的废话
    2020-12-05 05:44

    You can use the runkit extension for this, but you should really consider regular inheritance instead.

    See runkit_method_add.

提交回复
热议问题