我一直在尝试编写一个基本的身份验证系统,作为我应该使用的项目的一部分,以了解 Zend 框架。我一直在使用 Zend CLI 工具来帮助创建我的应用程序。我有一个名为 Admin 的模块,其中有一个名为 Auth 的控制器。但是,当我尝试在浏览器中导航到控制器时,出现以下错误:
An error occurred
Page not found
Exception information:
Message: Invalid controller specified (auth)
Stack trace:
#0 /home/www-data/zend.danielgroves.net/htdocs/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#1 /home/www-data/zend.danielgroves.net/htdocs/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#2 /home/www-data/zend.danielgroves.net/htdocs/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#3 /home/www-data/zend.danielgroves.net/htdocs/public/index.php(26): Zend_Application->run()
#4 {main}
Request Parameters:
array (
'module' => 'admin',
'controller' => 'auth',
'action' => 'index',
)
您可以前往 zend.danielgroves.net 亲自查看
据我所知,所有内容均已正确命名,请查看下面的屏幕截图,了解 CLI 工具如何构建所有内容。这是我在尝试构建此登录系统时遵循的指南http://akrabat.com/zend-auth-tutorial/。我刚刚到达登录屏幕截图的部分(第一张图片)。
任何帮助将不胜感激。
编辑 1
我的 application.ini 文件发布了@ByteNudger 建议的更改:
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
resources.db.adapter = "Pdo_Mysql"
resources.db.params.charset = "utf8"
resources.db.params.host = "localhost"
resources.db.params.username = ""
resources.db.params.password = ""
resources.db.params.dbname = ""
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.modules[] = "" (section [bootstrap])
[staging : production]
[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
application.ini 生成的 PHP 错误更改:
PHP Fatal error: Uncaught exception 'Zend_Config_Exception' with message 'syntax error, unexpected '(' in /home/www-data/zend.danielgroves.net/htdocs/application/configs/application.ini on line 20' in /home/www-data/zend.danielgroves.net/htdocs/library/Zend/Config/Ini.php:182
Stack trace:
#0 /home/www-data/zend.danielgroves.net/htdocs/library/Zend/Config/Ini.php(202): Zend_Config_Ini->_parseIniFile('/home/www-data/...')
#1 /home/www-data/zend.danielgroves.net/htdocs/library/Zend/Config/Ini.php(126): Zend_Config_Ini->_loadIniFile('/home/www-data/...')
#2 /home/www-data/zend.danielgroves.net/htdocs/library/Zend/Application.php(386): Zend_Config_Ini->__construct('/home/www-data/...', 'development')
#3 /home/www-data/zend.danielgroves.net/htdocs/library/Zend/Application.php(85): Zend_Application->_loadConfig('/home/www-data/...')
#4 /home/www-data/zend.danielgroves.net/htdocs/public/index.php(24): Zend_Application->__construct('development', '/home/www-data/...')
#5 {main}
thrown in /home/www-data/zend.danielgroves.net/htdocs/library/Zend/Config/Ini.php on line 182
编辑2:
好的,我刚刚尝试了下面罗斯史密斯二世在回答中提出的建议。我的 application.ini 文件现在显示:
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/modules/admin/controllers"
resources.frontController.params.displayExceptions = 0
resources.db.adapter = "Pdo_Mysql"
resources.db.params.charset = "utf8"
resources.db.params.host = "localhost"
resources.db.params.username = ""
resources.db.params.password = ""
resources.db.params.dbname = ""
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.defaultModule = "admin"
resources.layout.layoutPath = APPLICATION_PATH "/modules/admin/layouts/scripts/"
resources.modules[] =
[staging : production]
[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
我在浏览器中收到此错误:
Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)' in /home/www-data/zend.danielgroves.net/htdocs/library/Zend/Controller/Dispatcher/Standard.php:248 Stack trace: #0 /home/www-data/zend.danielgroves.net/htdocs/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 /home/www-data/zend.danielgroves.net/htdocs/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch() #2 /home/www-data/zend.danielgroves.net/htdocs/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run() #3 /home/www-data/zend.danielgroves.net/htdocs/public/index.php(26): Zend_Application->run() #4 {main} Next exception 'Zend_Controller_Exception' with message 'Invalid controller specified (error)#0 /home/www-data/zend.danielgroves.net/htdocs/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(O in /home/www-data/zend.danielgroves.net/htdocs/library/Zend/Controller/Plugin/Broker.php on line 336
自己看看:http: //zend.danielgroves.net/admin/auth/
编辑 3
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/modules/admin/controllers"
resources.frontController.params.displayExceptions = 0
resources.db.adapter = "Pdo_Mysql"
resources.db.params.charset = "utf8"
resources.db.params.host = "localhost"
resources.db.params.username = ""
resources.db.params.password = ""
resources.db.params.dbname = ""
resources.modules[] = ""
[staging : production]
[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1