我安装了 Zend Framework,但这里有一个大问题。当我进入应用程序的公共(public)文件夹(localhost/webserver/project/public/)时,我遇到了这个错误:
An error occurred
Page not found
Exception information:
Message: Invalid controller specified (public)
Stack trace:
0 C:\webserver\project\library\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
1 C:\webserver\project\library\Zend\Application\Bootstrap\Bootstrap.php(97): >end_Controller_Front->dispatch()
2 C:\webserver\project\library\Zend\Application.php(366): >Zend_Application_Bootstrap_Bootstrap->run()
3 C:\webserver\project\public\index.php(40): Zend_Application->run()
4 {main}
Request Parameters:
array (
'controller' => 'public',
'action' => 'index',
'module' => 'default',
)
我的公用文件夹被解释为 Controller 。 我正在使用 Xampp 在 Apache2.2 和 PHP5.3 中运行该应用程序。
我在 htdoc 上设置的 Document_Root 是“C:/webserver”,因为我在同一服务器上使用其他应用程序。我在公共(public)文件夹的 htaccess 中使用重写规则。
SetEnv APPLICATION_ENV development
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
我怎样才能做到这一点?
最佳答案
打开您的 application.ini 并添加
resources.frontController.baseurl = "webserver/project/public"
关于php - Zend Framework 上的公共(public)文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10144643/