Home  >  Article  >  Backend Development  >  已知一个php的文件,怎么知道这个文件里面是否含有类,类名是什么

已知一个php的文件,怎么知道这个文件里面是否含有类,类名是什么

WBOY
WBOYOriginal
2016-06-13 10:33:23703browse

已知一个php的文件,如何知道这个文件里面是否含有类,类名是什么?
已知一个php的文件,如何知道这个文件里面是否含有类,类名是什么?谢谢大家

------解决方案--------------------
$old = get_declared_classes();
include '文件名';
$new = get_declared_classes();
print_r(array_diff($new, $old));


当然你也可以读取文件用正则表达式搜索

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn