[PHP]How to check if a class inherits another class without instantiating it?

前端 未结 3 1804
轮回少年
轮回少年 2021-01-05 11:35

I have some class name. How to check if a class inherits another class without instantiating it?

 if (!class_exists($controller)) //AND I have check type
            


        
3条回答
  •  忘掉有多难
    2021-01-05 11:54

    You'll have to use reflection for that, it's pretty large topic:

    http://ca.php.net/manual/fr/book.reflection.php

    Look at the doc a little, try something and if you still have questions, something more precise, then post another question on that topic.

提交回复
热议问题