Php 如何在zend framework中列出所有控制器和操作
如何以编程方式列出所有模块、所有控制器以及每个模块的操作Php 如何在zend framework中列出所有控制器和操作,php,zend-framework,Php,Zend Framework,如何以编程方式列出所有模块、所有控制器以及每个模块的操作 谢谢它很管用。谢谢。代码很棒,但有个错误。下一行应该在2}号之前$acl[$module][$controller]=$actions;它起作用了。谢谢。代码很棒,但有个错误。下一行应该在2}号之前$acl[$module][$controller]=$actions; $front = $this->getFrontController(); $acl = array(); foreach ($front-
谢谢它很管用。谢谢。代码很棒,但有个错误。下一行应该在2}号之前$acl[$module][$controller]=$actions;它起作用了。谢谢。代码很棒,但有个错误。下一行应该在2}号之前$acl[$module][$controller]=$actions;
$front = $this->getFrontController();
$acl = array();
foreach ($front->getControllerDirectory() as $module => $path) {
foreach (scandir($path) as $file) {
if (strstr($file, "Controller.php") !== false) {
include_once $path . DIRECTORY_SEPARATOR . $file;
foreach (get_declared_classes() as $class) {
if (is_subclass_of($class, 'Zend_Controller_Action')) {
$controller = strtolower(substr($class, 0, strpos($class, "Controller")));
$actions = array();
foreach (get_class_methods($class) as $action) {
if (strstr($action, "Action") !== false) {
$actions[] = $action;
}
}
}
}
$acl[$module][$controller] = $actions;
}
}
}