Find out if a method exists in a static class

后端 未结 3 1279
感动是毒
感动是毒 2020-12-28 12:54

I want to check is a function exists in a library that I am creating, which is static. I\'ve seen function and method_exists, but haven\'t found a way that allows me to call

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-28 13:12

    Update:

    Ahh, apologies. I was temporarily blind :) You'll want to use the magic constant __CLASS__

    e.g.

    if (method_exists(__CLASS__, "test3")) { echo "Hi"; }
    

提交回复
热议问题