Get class name from file

后端 未结 10 1854
轮回少年
轮回少年 2020-12-08 10:29

I have a php file which contains only one class. how can I know what class is there by knowing the filename? I know I can do something with regexp matching but is there a st

10条回答
  •  情话喂你
    2020-12-08 11:13

    You could get all declared classes before you include the file using get_declared_classes. Do the same thing after you have included it and compare the two with something like array_diff and you have your newly added class.

提交回复
热议问题