花了一段时间,但我发现这可以通过自定义调度程序完成:
<?php
namespace Webjawns\Controller\Dispatcher;
use Zend_Controller_Dispatcher_Standard as Dispatcher;
class Standard extends Dispatcher
{
/**
* Format action class name
*
* @param string $moduleName Name of the current module
* @param string $className Name of the action class
* @return string Formatted class name
*/
public function formatClassName($moduleName, $className)
{
return $this->formatModuleName($moduleName) . '\Controller\\' . $className;
}
/**
* Convert a class name to a filename
*
* @param string $class
* @return string
*/
public function classToFilename($class)
{
return str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php';
}
}
然后在应用程序入口点的某处:
Zend_Controller_Front::getInstance()->setDispatcher(
new \Webjawns\Controller\Dispatcher\Standard());