How do I get class name in PHP?

后端 未结 10 1994
名媛妹妹
名媛妹妹 2020-11-29 04:37
public class MyClass {

}

In Java, we can get class name with String className = MyClass.class.getSimpleName();

How to do this

10条回答
  •  旧巷少年郎
    2020-11-29 05:04

    end(preg_split("#(\\\\|\\/)#", Class_Name::class))

    Class_Name::class: return the class with the namespace. So after you only need to create an array, then get the last value of the array.

提交回复
热议问题