Zend框架中的”指定了无效的控制器”错误

“Invalid controller specified” error in zend framework

我使用zf工具在" http:// localhost / work / qwafel "中创建项目。

我创建了URL " http:// localhost / work / qwafel / public ",它显示索引控制器索引操作正常。但是当我导航到" http:// localhost / work / qwafel / public / index "时,出现此错误

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
An error occurred

Page not found

Exception information:

Message: Invalid controller specified (work)

Stack trace:

#0 C:\\xampp\\htdocs\\Work\\qwafel\\library\\Zend\\Controller\\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#1 C:\\xampp\\htdocs\\Work\\qwafel\\library\\Zend\\Application\\Bootstrap\\Bootstrap.php(97): Zend_Controller_Front->dispatch()
#2 C:\\xampp\\htdocs\\Work\\qwafel\\library\\Zend\\Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#3 C:\\xampp\\htdocs\\Work\\qwafel\\public\\index.php(26): Zend_Application->run()
#4 {main}  
Request Parameters:

array (
  'controller' => 'work',
  'action' => 'qwafel',
  'public' => 'index',
  'module' => 'default',
)

我不知道为什么我使用zf工具创建了许多项目,而该工具仍能正常工作

没人在那里吗?帮忙!!


使用zf命令行工具创建zf项目时,它始终具有IndexControllerindexAction函数。因此,您应该能够运行它。

但是,您的项目设置似乎有问题。我可以将zend项目复制到htdocs文件夹中的任何目录,它仍然可以使用。

打开命令行工具并导航到任何目录并创建一个项目:

1
zf create project test

请勿修改项目,请将其复制到htdocs中的任何文件夹中。现在对我来说一切都很好。


在子文件夹中安装Zend Framework有点棘手。

编辑您的.htaccess文件以使其具有:

1
RewriteBase /work/qwafel

那应该做...