私はPHP ReflectionClassを知っているので、PHPスクリプトからドキュメンテーションコメントを得ることができます。今では、クラスを使用していない数百もの古いPHPスクリプトを見てきましたが、単純なパブリック関数だけです。私が正しければ、ReflectionClassはここでは使用できません。私の目標は各文書のコメントを抽出することです。例えば。 test1.php
には、次の行が含まれていますクラスを使用していないPHPスクリプトからDocコメントを抽出するには?
<?php
/**
* some main comments here
*/
...some php lines here...
/**
* function comment
* Blah blah
*/
function foo()
{
...some php lines here...
}
...and more functions below each with comments
?>
だから私の希望出力に含まのようになりますようにテーブル:あなたはあなたが持っている場合には(結果は次のようになりReflectionFunction
$functions = get_defined_functions();
foreach ($functions['user'] as $function) {
$reflection = new ReflectionFunction($function);
var_dump($reflection->getName());
var_dump($reflection->getDocComment());
}
を使用することができます
--------------------------------------------------
| Filename | FUNCTION | Comment |
--------------------------------------------------
| test1.php | | some main comments here |
| test1.php | foo() | function comment |
| | | Blah Blah |
いくつかのドキュメントジェネレータを試しましたか? http://phpdox.de/またはhttps://phpdoc.org/ – muescha
ミューシャ、ありがとうございます。未だに。私はあなたが私にさらにヒントを与えることができれば感謝します:) – tatskie