/** * @param $class \ReflectionClass * ��ȡController��Action */ private function getActions($class) { $result = []; foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) { $methodName = $method->getName(); if (strpos($methodName, 'action') === 0 && $methodName !== 'actions') { $method = new \ReflectionMethod($class->getName(), $methodName); $doc = DocHelper::getDocComment($method->getDocComment()); $result[str_replace("action", "", $methodName)] = $doc ? $doc : $methodName; } } return $result; }
/** * @param $class \ReflectionClass * ��ȡController��Action */ private function getActions($class) { $result = []; foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) { $methodName = $method->getName(); $id = str_replace("action", "", $methodName); //只筛选index的action if (strpos($methodName, 'action') === 0 && $methodName !== 'actions' && in_array($id, ['Index'])) { $method = new \ReflectionMethod($class->getName(), $methodName); $doc = DocHelper::getDocComment($method->getDocComment()); $result[$id] = $doc ? $doc : $methodName; } } return $result; }
</td> <td> <p><a href="/detail/?doc-id=<?php echo $docInfo['id']; ?> "><?php echo $docInfo['title'] ? $docInfo['title'] : ' - '; ?> </a></p> <p>展示地址: <a style="color:#333;" href="<?php echo DocHelper::getDocUrl($docInfo['id']); ?> " target="_blank"> <?php echo DocHelper::getDocUrl($docInfo['id']); ?> </a> </p> </td> <td><?php echo Arr::get($docInfo['category'], DocVars::$CATEGORY, '其他'); ?> </td> <td><?php echo $userInfo['username']; ?> </td> <td><?php echo $docInfo['hidden'] ? '<span class="green">隐藏</span>' : '<span class="red">显示</span>'; ?>