How do I dynamically invoke a class method in PHP?

后端 未结 9 1025
时光取名叫无心
时光取名叫无心 2020-12-08 01:52

How can I dynamically invoke a class method in PHP? The class method is not static. It appears that

call_user_func(...)

only works with st

9条回答
  •  [愿得一人]
    2020-12-08 02:33

    call_user_func(array($object, 'methodName'));
    

    For more details, see the php callback documentation.

提交回复
热议问题