问题
Anytime I use an <img>
tag in my Zend Framework application, no image is displayed. When I type the absolute path into the address bar, the front controller attempts to find an "images" controller.
There HAS to be a way I can use <img src="/public/images/logo.png">
in Zend Framework right?
I've tried it from within views, layouts, and helpers, and no luck. I've also used the $this->baseURL()
technique, and the serverURL()
technique by getting the info from the Front Controller, but it still won't show the image... anywhere on the site. (I have the same problem with including css files unless I do an @import('/css/main.css')
回答1:
Sounds like an problem with your .htaccess file you have to exclude this files from the reWrite rule, otherwise those requests are routed to index.php.
/public/.htaccess
RewriteEngine on
RewriteRule !\.(js|ico|txt|gif|jpg|png|css)$ index.php
来源:https://stackoverflow.com/questions/10442338/zend-keep-front-controller-from-blocking-image-requests