[PHP]怎么列出位于某个命名空间内定义的class?

WBOY
Release: 2016-06-06 20:40:12
Original
903 people have browsed it

用get_declared_classes()貌似会列出所有的class。
如果用反射的话需要创建大量ReflectionClass对象。
请问还有什么方法能迅速列出命名空间内定义的所有class,而且不严重消耗资源?

回复内容:

用get_declared_classes()貌似会列出所有的class。
如果用反射的话需要创建大量ReflectionClass对象。
请问还有什么方法能迅速列出命名空间内定义的所有class,而且不严重消耗资源?

  1. 首先你得遵守PSR-4之类的靠谱规范
  2. 然后用glob即可
Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template