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

后端 未结 5 1274
情深已故
情深已故 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:30

    If the class in question implements __call magic, then it's possible, and quite easy. If you want to know how this works I suggest you read Extending objects with new methods at runtime.

提交回复
热议问题