比方說,我有:通過讀取功能評論(PHP)自動創建文件
class myclass {
/*
* This function, bla bla bla
*/
function myclass()
{
return(true);
}
/*
* This function, bla bla bla
*/
function myfunc1()
{
return(true);
}
/*
* This function, bla bla bla
*/
function myfunc2()
{
return(true);
}
}
通過使用get_class_methods(new myclass());
我能得到的類。
現在我的問題是這樣的:我可以從類函數讀取註釋到字符串中嗎? 所以我可以創建自動生成的文檔。
使用[phpDocumentor的(http://www.phpdoc.org/),和其他人一樣做;但docblocks應該來___before___方法定義,而不是在他們內部 – 2014-09-27 11:09:21
謝謝@MarkBaker我知道PHPDocumentor,但我想自己做一些事情:-) 更新了示例,我仍然想知道我怎麼能得到這些評論: - P – 2014-09-27 11:24:16
如果您想重新發明輪子,請使用[反射](http://www.php.net/manual/en/book.reflection.php),特別是'getDocComment()'方法....但注意,'爲了用這種方法檢索評論,評論必須在類,函數或方法之前立即執行' – 2014-09-27 11:31:54