了解文件夹“图像”作为控制器
当我尝试访问 url http://localhost/mysite/public/images/grey 时-arrow.gif 在我的应用程序的控制器中,我收到错误:
致命错误:未捕获异常“Zend_Controller_Dispatcher_Exception”,消息“指定的控制器(图像)”在 C:\xampp\php\PEAR\Zend\Controller 中\Dispatcher\Standard.php:242 堆栈跟踪: #0 C:\xampp\php\PEAR\Zend\Controller\Front.php(946): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) # 1 D:\Users\rnem\www\mysite\application\Bootstrap_Aplicativo.php(64): Zend_Controller_Front->dispatch() #2 D:\Users\rnem\www\regnet3.0\home\index.php(3 ): include_once('D:\Users\rnem\w...') #3 {main} 在第 242 行 C:\xampp\php\PEAR\Zend\Controller\Dispatcher\Standard.php 中抛出
为什么它在思考images 是一个控制器而不是一个文件夹?!
When I try to access the url http://localhost/mysite/public/images/grey-arrow.gif in a controller in my application I get the error:
Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (images)' in C:\xampp\php\PEAR\Zend\Controller\Dispatcher\Standard.php:242 Stack trace: #0 C:\xampp\php\PEAR\Zend\Controller\Front.php(946): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 D:\Users\rnem\www\mysite\application\Bootstrap_Aplicativo.php(64): Zend_Controller_Front->dispatch() #2 D:\Users\rnem\www\regnet3.0\home\index.php(3): include_once('D:\Users\rnem\w...') #3 {main} thrown in C:\xampp\php\PEAR\Zend\Controller\Dispatcher\Standard.php on line 242
Why is it thinking images is a controller instead of a folder as it is?!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
/public 中的 .htaccess 文件中有什么?
What do you have in your .htaccess file in /public?
这就是我所拥有的
This is what I have
我认为您可能需要通过虚拟主机配置访问您的站点,而不是仅仅通过
localhost
进行路径访问。我怀疑 URL 重写器无法找到您的图像文件,因为它不知道public
是提供文件的根目录,因此它会尝试将 URL 解释为控制器动作。Zend Framework 快速入门
I think you might need to access your site via a virtual host configuration, instead of just path-ing out via
localhost
. I suspect the URL re-writer can't find your image file because it doesn't know thatpublic
is the root directory files are served from, so it falls back on trying to interpret the URL as a controller action.Creating a virtual host is covered in the Zend Framework Quickstart
zend 的默认 htaccess 是:
Give that a go。如果这不起作用,上面提到的虚拟主机应该是:
将其放入您的虚拟主机conf文件中,请记住取消注释httpd.conf中的虚拟主机行。这可能会有所帮助,http://www.tildemark.com/software/servers/setting-up-virtual-hosts-with-xampp-running-on-windows-xp.html,否则谷歌上有很多指导
The default htaccess for zend is:
Give that a go. If that doesn't work the vhosts mentioned above should be:
Put that into your vhosts conf file, remember to uncomment the vhosts line in your httpd.conf. This might help, http://www.tildemark.com/software/servers/setting-up-virtual-hosts-with-xampp-running-on-windows-xp.html, otherwise there's plenty of giudes on google