【发布时间】:2010-10-17 00:34:06
【问题描述】:
我正在做一些自制的自动化文档,因为我有一个布局不是很标准的代码库,我想知道最好的方法是读取 PHP 文件并获取注释块的内容.我能想到的唯一方法是打开文件并逐行读取,但我想也许有一些内置的魔法可以为我解析文档,类似于反射函数。
每个文件的基本布局是这样的:
<?php // $Id$
/**
* Here is this script's documentation, with information in pseudo-javadoc
* type tags and whatnot.
*
* @attr something some information about something
* @attr etc etc etc
*/
// rest of the code goes here.
请务必注意,这些文件中没有定义任何函数或类。 cmets 与整个脚本相关。
【问题讨论】:
-
我认为这个答案可能会有所帮助Read comments block from file
标签: php reflection comments