【发布时间】:2025-12-03 02:00:01
【问题描述】:
我在尝试记录我的项目时遇到了一个奇怪的问题。我有以下代码:
//! Set default ::$action for called controller. If no action is called, default (index) will be set.
$action = isset($_GET[ 'action']) ? $_GET[ 'action'] : 'index';
if ($action) {
echo 'something 1';
}else{
echo 'something 2';
}
//! Set default ::$action2 for called controller. If no action is called, default (index) will be set.
$action2 = isset($_GET[ 'action']) ? $_GET[ 'action'] : 'index';
//! Set default ::$action3 for called controller. If no action is called, default (index) will be set.
$action3 = isset($_GET[ 'action']) ? $_GET[ 'action'] : 'index';
Doxygen 生成以下内容:
如您所见,$action2 不见了。我检查了我的其他文件之一并看到了同样的问题。 if 声明之后的下一件事永远不会记录在案,但之后的事情会记录在案。如果我从上面的示例中删除 if 语句,我将获得所有 4 个变量的文档 - $page、$action、action2 和 action3。
我花了很多时间试图弄清到底是哪里出了问题,但没有运气,所以欢迎每一个建议。
系统是: 带有 Doxygen 1.7.4 的 Windows XP x64。 (我使用的是 Doxygen GUI)
更新
另外,当我的代码中有类似的东西时(注意if 语句中缺少else)。当我添加}else{} 时,它可以工作。下一个$variables 没有再次记录,但该更新是关于if/else。
Doxygen 将其转换为 this
【问题讨论】:
-
@yes123 我相信它会从 PHP cmets 生成文档。
-
增加了 150 声望赏金,有人吗?
-
由于所有 3 个解决方案(到目前为止)都是有效的,并且每个解决方案都提供了非常有用的信息,我不得不给 3 个投票支持,并为 David 打上复选标记,这是第一个并且还指向附加链接,如果决定开始使用 doxygen,这对某人非常有帮助。