开发者

Action "foo/foobar" does not exist error in Symfony

I am saving pictures under my web folder in the folder:

web/media/photo

In the template that displays the photo, I have the following snippet:

<?php echo link_to(image_tag('media/photo/filename.jpg', '@some_url); ?>

When I display the view, although the photo is displayed correctly and the link works, I get the following开发者_C百科 error in my php_errors.log file:

Action "media/photo" does not exist.

Why is symfony trying to parse the path to the image as a url?

Does anyone know how to fix this?


Add a leading slash to the image path:

<?php echo link_to(image_tag('/media/photo/filename.jpg', '@some_url); ?>

This will prevent Apache from redirecting to the media/photo action in symfony that is matched the mod_rewrite rules in .htaccess.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜